安装npm install express-generator -g时出错

时间:2015-10-06 09:34:59

标签: javascript node.js windows express npm

npm install express导致以下错误。如何解决此问题?这个问题已经有很多重复的INCORRECT答案,我正在用下面的正确答案分享这个问题以便清理。

-bash-3.2$ npm install express-generator -g
npm WARN engine express-generator@4.13.1: wanted: {"node":">= 0.10"} (current: {"node":"v0.9.4-pre","npm":"1.4.16"})
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/bin/express'
npm ERR! error rolling back  express-generator@4.13.1 { [Error: EACCES, unlink '/usr/local/bin/express'] errno: 3, code: 'EACCES', path: '/usr/local/bin/express' }
npm ERR! Error: EACCES, unlink '/usr/local/bin/express'
npm ERR!  { [Error: EACCES, unlink '/usr/local/bin/express'] errno: 3, code: 'EACCES', path: '/usr/local/bin/express' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 2.6.23.17-88.fc7
npm ERR! command "node" "/usr/local/bin/npm" "install" "express-generator" "-g"
npm ERR! cwd /home/sukumar/www/nodejs/socialgrow
npm ERR! node -v v0.9.4-pre
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/bin/express
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/bin/express'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sukumar/www/nodejs/socialgrow/npm-debug.log
npm ERR! not ok code 0

1 个答案:

答案 0 :(得分:-1)

您只能使用root / admin全局安装模块(-g)。以root身份运行并重试。