我想在npm之前安装一些东西,但是它显示“错误”和“ checkPermissions丢失”

时间:2018-10-18 02:24:12

标签: node.js npm

这是我的第一篇文章,所以我不确定是否正确回答我的做法。.哈哈

Jongryului-MacBook-Pro:~ jongryulpark$ npm install uglify-js -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
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! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jongryulpark/.npm/_logs/2018-10-18T01_28_56_508Z-debug.log
Jongryului-MacBook-Pro:~ jongryulpark$ 

要解决此问题,我用谷歌搜索了,听说了nvm ..但这都不起作用

1 个答案:

答案 0 :(得分:1)

尝试使用sudo运行命令。

  

sudo npm install