我正在尝试使用此代码安装 react-devtools
sudo npm install -g react-devtools
运行此命令后,出现此错误。
/usr/local/bin/react-devtools -> /usr/local/lib/node_modules/react-devtools/bin.js
> electron@1.6.11 postinstall /usr/local/lib/node_modules/react-devtools/node_modules/electron
> node install.js
/usr/local/lib/node_modules/react-devtools/node_modules/electron/install.js:47
throw err
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/react-devtools/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.6.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jayakrishnan/.npm/_logs/2017-08-07T11_22_05_742Z-debug.log
我该如何纠正这个问题?我迫切需要 devtools 进行调试。如果可能,请推荐更好的 React Native 调试工具。
最佳答案
基于 this issue尝试以下命令来解决此问题:
sudo npm install -g react-devtools --unsafe-perm=true
allow-root
选项没有解决这个问题。
关于android - 尝试安装 react-devtools 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45559508/