请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

终端提示以下错误,不知道要怎么解决

$ npm install -g express-generator@4

/usr/local/lib

└─┬ express-generator@4.13.4 

  ├─┬ commander@2.7.1 

  │ └── graceful-readlink@1.0.1 

  ├─┬ mkdirp@0.5.1 

  │ └── minimist@0.0.8 

  └── sorted-object@2.0.0 


npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8

npm ERR! path /usr/local/lib/node_modules/.staging/accepts-384fbfdc

npm ERR! code EACCES

npm ERR! errno -13

npm ERR! syscall rmdir


npm ERR! Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/.staging/accepts-384fbfdc'

npm ERR!     at Error (native)

npm ERR!  { Error: EACCES: permission denied, rmdir '/usr/local/lib/node_modules/.staging/accepts-384fbfdc'

npm ERR!     at Error (native)

npm ERR!   errno: -13,

npm ERR!   code: 'EACCES',

npm ERR!   syscall: 'rmdir',

npm ERR!   path: '/usr/local/lib/node_modules/.staging/accepts-384fbfdc' }

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/dengdf/npm-debug.log

Pan-Mac:~ Pan$ sudo npm install -g express-generator@4

Password:

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Darwin 15.6.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "express-generator@4"

npm ERR! node v6.7.0

npm ERR! npm  v3.10.8


npm ERR! uid must be an unsigned int

npm ERR! 

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>


npm ERR! Please include the following file with any support request:



正在回答 回答被采纳积分+3

1回答

vczero_ 2016-10-25 12:09:26

你好啊,重点错误信息是这个:npm ERR! Error: EACCES: permission denied, 

表明没有写入权限。因此,我们需要提升权限,具体的有两种方案:

  1. 加上sudo,  输入自己本机密码

    sudo npm install -g express-generator

  2. 如果你有root账户权限,直接切入到root账户即可。然后再执行

    npm install -g express-generator

    建议采用(1)方案。 :)

0 回复 有任何疑惑可以回复我~
  • 提问者 Pan14 #1
    第一种试过了,提示错误和之前的一样的。请问老师,如何用第二种方案切入root账户?
    回复 有任何疑惑可以回复我~ 2016-10-26 08:48:59
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信