安装npm安装错误- express-generator -g [duplicate]

时间:2020-12-11 22:55:58

This question already has an answer here:

这个问题已经有了答案:

npm install express results in the following error.How to resolve this? There are already many duplicates of this question with INCORRECT answers, I'm sharing this with the below CORRECT answer to clear things up.

npm安装express会导致以下错误。如何解决这个问题?这个问题已经有很多重复的错误答案,我将与下面的正确答案分享,以澄清问题。

-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 个解决方案

#1


-1  

You can only install modules globally ( -g ) with root / admin. Run it as root and try again.

您只能使用root / admin全局安装模块(-g)。把它作为根来运行,再试一次。

#1


-1  

You can only install modules globally ( -g ) with root / admin. Run it as root and try again.

您只能使用root / admin全局安装模块(-g)。把它作为根来运行,再试一次。