在使用 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
解決~