简体   繁体   English

“ npm i -g gulp”安装错误

[英]“npm i -g gulp” install error

I'm trying to install this: npm i -g gulp 我正在尝试安装:npm i -g gulp

But the output are these lines: 但是输出是这些行:

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

Just in case: when I ran npm root -g , I got the correct root folder: /usr/local/lib/node_modules 以防万一:当我运行npm root -g时 ,我得到了正确的根文件夹: / usr / local / lib / node_modules

Please, how can I solve this? 拜托,我该怎么解决? And install npm i -g gulp ?? 并安装npm i -g gulp

Thanks! 谢谢!

see the error message: EACCES: permission denied . 请参阅错误消息: EACCES: permission denied Link to fixing npm permissions . 链接到修复npm权限

for me, on a new system I'll execute the command found at the reference above: 对我来说,在新系统上,我将执行上面参考中找到的命令:

 sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

There is another option show at the link above for changing the directory where NPM installs packages to. 上面的链接上显示了另一个选项,用于更改NPM将软件包安装到的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM