Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when trying to install react-devtools

I am trying to install react-devtools with this code

sudo npm install -g react-devtools

after running this command, I am getting this error.

/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

How can I correct this? I am desperately in need of devtools for debugging. If possible, please suggest better debugging tools for React Native.

like image 621
mad_greasemonkey Avatar asked Dec 02 '22 12:12

mad_greasemonkey


2 Answers

Based on this issue try the following command to fix this issue:

sudo npm install -g react-devtools --unsafe-perm=true

allow-root option doe's not solving this issue.

like image 178
Vahid Kharazi Avatar answered Dec 06 '22 10:12

Vahid Kharazi


I solved this issue by using yarn.

brew install yarn
yarn global add react-devtools

You don't need to change permissions this way.

like image 44
Patrik Rikama-Hinnenberg Avatar answered Dec 06 '22 11:12

Patrik Rikama-Hinnenberg