当我运行命令" npm install -g yo bower grunt-cli gulp"时出现此错误。 有谁知道问题是什么?
npm ERR! tar.unpack untar error /Users/??????/.npm/grunt-cli/0.1.13/package.tgz
npm ERR! tar.unpack untar error /Users/??????/.npm/yo/1.4.7/package.tgz
npm ERR! tar.unpack untar error /Users/??????/.npm/gulp/3.9.0/package.tgz
npm ERR! tar.unpack untar error /Users/??????/.npm/bower/1.4.1/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "yo" "bower" "grunt-cli"
"gulp"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/grunt-cli',
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/??????/npm-debug.log
答案 0 :(得分:1)
正如Vohuman指出的那样,将其作为sudo来解决问题。您正在尝试全局安装这些需要访问您没有写入权限的/usr/local
的软件包,正如错误消息所示,please try running this command again as root/Administrator.
Even"登录"作为root(sudo su)[On CentOS]
sudo npm install -g ...
否则仍以用户身份执行,可能是目录所有者?