我在我的Mac上下载node,当我运行我的项目并安装npm时,我遇到了这个错误[关闭]

eulz3vhy  于 2023-03-22  发布在  Node.js
关注(0)|答案(2)|浏览(302)

**已关闭。**此问题为not about programming or software development。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
昨天关门了。
Improve this question

npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /Users/njwd./.npm/_cacache/tmp/7216a635
npm ERR! errno -13
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 501:20 "/Users/njwd./.npm"

npm ERR! Log files were not written due to an error writing to the directory: /Users/njwd./.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

[在此处输入图像描述](https://i.stack.imgur.com/hjUfM.png

w8f9ii69

w8f9ii691#

您应该通过向npm文件夹授予必要的权限来解决这个问题。

sudo chown -R 501:20 "/Users/njwd./.npm"

希望这能帮上忙。

34gzjxbg

34gzjxbg2#

尝试清空npm缓存

npm cache clean --force

您使用的是哪个节点版本?

node -v

我建议使用node版本管理器来安装node/npm

相关问题