当我试图安装时,我的Mac上出现了这个错误
Hakk-MBP:HelloWorld hakkikonu$ sudo npm install -g react-devtools
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/hakkikonu/.npm/_cacache/index-v5/ad/f6'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/hakkikonu/.npm/_cacache/index-v5/da/f2'
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/hakkikonu/.npm/_logs/2019-02-05T14_33_58_146Z-debug.lognpm版本为: 6.7.0
原因何在?
发布于 2019-02-11 19:27:35
编辑
我相信此链接是正确的解决方案。
或
原始答案
警告:这损害了安全!它使得在没有根访问权限的情况下运行的恶意代码有可能将代码写入这些目录,在这些目录中,代码可能以root形式运行。
在这里上,不要以sudo的方式在Mac上运行:
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib
sudo chown -R $(whoami) /usr/local/bin然后在没有sudo的情况下再次尝试您的命令。例如:(在你的情况下,反应-devtools)
npm install -g npm@latest这解决了我升级到NPMV6.7.0后的问题。
https://stackoverflow.com/questions/54536744
复制相似问题