为什么 OS X 执行 npm install -g xx 命令的时候总是报错啊!
发布于 10个月前 作者 cyin15288 614 次浏览

在 OS X 上面开发 Node.js,各种 npm 包装不上,在 Win7 下面各种顺利!为毛啊

npm ERR! error rolling back Error: EACCES, unlink '/Users/jiangyin/npm/bin/node-supervisor'
npm ERR! error rolling back  supervisor[@0](/user/0).6.0 { [Error: EACCES, unlink '/Users/jiangyin/npm/bin/node-supervisor']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/Users/jiangyin/npm/bin/node-supervisor' }
npm ERR! Error: EACCES, unlink '/Users/jiangyin/npm/bin/node-supervisor'
npm ERR!  { [Error: EACCES, unlink '/Users/jiangyin/npm/bin/node-supervisor']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/jiangyin/npm/bin/node-supervisor' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "supervisor"
npm ERR! cwd /
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /Users/jiangyin/npm/bin/node-supervisor
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/Users/jiangyin/npm/bin/node-supervisor'
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "supervisor"
npm ERR! cwd /
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm ERR! not ok code 0
3 回复

在os X下使用全局安装需要使用sudo提升权限.

请看这一句npm ERR! Please try running this command again as root/Administrator.

如果你使用了nvm的话,就不需要了

不熟悉命令行用法而且不熟悉英文的结果…

关键是我还用了加sudo,能成功安装!但是不能运行命令~!

回到顶部