安装 React Devtools 时出错

安装 React Devtools 时出错

我正在尝试使用此代码安装 react-devtools

sudo npm install -g react-devtools

运行此命令后,出现此错误。

/usr/local/bin/react-devtools -> /usr/local/lib/node_modules/react-devtools/bin.js

> [email protected] 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! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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 推荐更好的调试工具。

答案1

这对我来说很有效:

sudo npm install -g electron --unsafe-perm=true --allow-root

相关内容