在使用 npm install 时,总提示:

Error: EACCES: permission denied

今天通过这个命令设置了权限解决了问题:

sudo chown -R $(whoami) ~/.npm

方法来自:https://stackoverflow.com/a/51923345/1185971

---

在安装 node-gyp 时提示:

Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/baidu/.npm/_cacache/tmp'

npm ERR! cb() never called!

采用上文方法处理后,又提示:

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

于是,又执行了一个:

sudo chown -R $(whoami)  /usr/local/lib/node_modules

解决~

posted on 2019-03-13 11:04  死宅程序员  阅读(1020)  评论(0)    收藏  举报