简体   繁体   English

npm install -g webpack给出tar.unpack解压缩错误

[英]npm install -g webpack gives tar.unpack untar error

I created a new user on my Mac and tried this. 我在Mac上创建了一个新用户,并尝试了此操作。 This normally works in my other account. 这通常可以在我的其他帐户中使用。 This new user is an administrator also. 该新用户也是管理员。

  npm ERR! tar.unpack untar error /Users/test/.npm/webpack/1.11.0/package.tgz
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "webpack"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! path /usr/local/lib/node_modules/webpack
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/webpack'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/webpack']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/webpack',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/webpack',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/test/WebstormProjects/babel-test/npm-debug.log

I am not very good with the UNIX stuff and things, I just wish these things would be more easy. 我对UNIX的东西不是很好,我只是希望这些东西会更容易。

From the looks of it, since it says EACCES, it is probably getting an access denied from the system. 从它的外观来看,由于它说为EACCES,因此可能是系统拒绝了访问。 If you are installing globally on unix you must use sudo. 如果要在Unix上全局安装,则必须使用sudo。

$ sudo npm install -g webpack

Start using nvm and it will save you from using sudo at all. 开始使用nvm ,它将完全使您免于使用sudo

https://github.com/creationix/nvm https://github.com/creationix/nvm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM