我在Mac上创建了一个新用户,并尝试了此操作。这通常可以在我的其他帐户中使用。该新用户也是管理员。

  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


我对UNIX的东西不是很好,我只是希望这些东西会更容易。

最佳答案

开始使用nvm,它将完全使您免于使用sudo

https://github.com/creationix/nvm

关于node.js - npm install -g webpack给出tar.unpack解压缩错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32058299/

10-11 07:23