首页 > 解决方案 > 我在使用 npm install express 时遇到问题

问题描述

我正在学习使用 nodeJs 的 express 框架。我在使用安装 express 时遇到问题npm install express --save

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

标签: node.jsexpressnpm-install

解决方案


将用户的 npm 相关文件夹的所有权恢复到当前用户,如下所示:

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

然后尝试

sudo npm install express --save

推荐阅读