npm install express --save
安装Express时遇到问题
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/37/92'
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/22/9a'
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/06/5a'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/akandegeorge/.npm/_logs/2019-08-18T18_13_54_120Z-debug.log
答案 0 :(得分:0)
在MacOS上,当主文件夹上的权限错误并阻止npm在磁盘上创建文件时,会发生此问题。您可以通过resetting your home folder's permissions来解决此问题。
答案 1 :(得分:0)
将用户与npm相关的文件夹的所有权恢复到当前用户,就像这样:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
然后尝试
sudo npm install express --save