在 npm 安装上:未处理的拒绝错误:EACCES:权限被拒绝 [英] On npm install: Unhandled rejection Error: EACCES: permission denied
问题描述
我设法破坏了我的 npm
安装,每当我尝试使用 npm install
安装软件包时,我都会收到以下错误消息:
I have managed to corrupt my npm
install, and whenever I try to install packages using npm install
, I receive error messages along these lines:
未处理的拒绝错误:EACCES:权限被拒绝,打开'/Users/marknorgate/.npm/_cacache/tmp/a449402d'
Unhandled rejection Error: EACCES: permission denied, open '/Users/marknorgate/.npm/_cacache/tmp/a449402d'
我尝试重新安装节点 &npm,我还尝试使用 这些说明将我的 npm 缓存重新定位到其他地方 但没有任何效果.
I have tried reinstalling node & npm, and I have also tried to relocate my npm cache elsewhere using these instructions but nothing works.
我怎样才能让它工作?
推荐答案
恢复用户的 npm 相关文件夹的所有权,给当前用户,像这样:
Restore ownership of the user's npm related folders, to the current user, like this:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
这篇关于在 npm 安装上:未处理的拒绝错误:EACCES:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!