Running:
$ sudo npm install -g react-devtools
Hangs when trying to install electron. Can be reproduced with $ npm install electron
.
installing electron with my package manager, then reinstalling react-devtools seems to work
hmm actually, even if npm install didn't raise an error, react-devtools is still unusable:
$ react-devtools [99f5547; 14:23:33]
/usr/lib/node_modules/react-devtools/node_modules/electron/index.js:9
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object.<anonymous> (/usr/lib/node_modules/react-devtools/node_modules/electron/index.js:9:9)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/react-devtools/bin.js:2:16)
at Module._compile (module.js:571:32)
Of course, I tried to remove the node_modules/electron dir several times and reinstalling without success (still hangs)
Why are you running this command with sudo? Generally using sudo with npm is extremely error prone and leads to all sorts of issues with corrupted permissions.
I used sudo because I cannot install globally as my user, something to do with the nobody user.
➜ npm install -g react-devtools [62f233c; 10:59:45]
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/react-devtools/node_modules/electron
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/react-devtools
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/react-devtools/node_modules/react-devt
ools-core
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/react-devtools/node_modules
/usr/lib
└─┬ [email protected]
├─┬ [email protected]
│ └── @types/[email protected]
└── [email protected]
npm ERR! path /usr/lib/node_modules/react-devtools/node_modules/electron
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/react-devtools/node_modules/electron'
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules/react-devtools/node_modules/electr
on'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules/react-devtools/node_modules/electron' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dori/.npm/_logs/2017-05-29T01_59_56_811Z-debug.log
You should change global Node modules directory to something writable by all users. Not saying this will fix the problem but it's a better way. Npm just doesn't work well with sudo.
Did changing permissions on the /usr/lib/node_modules/
directory resolve this issue for you @Fandekasp?
I just checked and was able to npm i -g react-devtools
without any problem.
my react native project got cancelled, and I'm already using the chrome extension for react-devtools, so I don't need to install this locally anymore. Closing.
chown USER:root /usr/lib/node_modules/ resolves "EACCES: permission denied, access /usr/lib/node_module"
Been having the same issue (wasn't using sudo for npm i), resolved it by globally installing electron and then react-devtools.
After fixing the permission issue with npm global install (see https://docs.npmjs.com/getting-started/fixing-npm-permissions) (I did Option 2), i do the following:
$ npm uninstall -g react-devtools
$ npm uninstall -g electron
$ npm install -g --verbose react-devtools
Then the terminal will show the downloading process:
For me it was done within 5 minutes, and then $ react-devtools
works.
This does the trick for me.
sudo npm install -g react-devtools --unsafe-perm=true
@ghost Thanks that solve the issue !!!
@brancooo1 Thanks your solution works for me.
@brancooo1 thanks ... it works :+1:
@ghost thanks a lot!
@brancooo1 yeah
I've changed rights on global node_modules directory and then installed devtools
cd /usr/local/lib
sudo chown -R user:user node_modules
npm i -g react-devtools
And it installed normally
after trying all other options - this one worked as pointed out by @brancooo1
sudo npm install -g react-devtools --unsafe-perm=true
adding --unsafe-perm=true
option is work for me
thanks for @brancooo1
What does the flag --unsafe-perm=true mean???? I used it and it worked but i do know understand what i just did. Please point me to a resource to learn this.to know.thanks
@brancooo1 thank's
Maybe this is what you want
https://stackoverflow.com/questions/49260428/how-can-i-open-react-devtools/53058331#53058331
sudo npm install -g react-devtools --unsafe-perm=true
The real solution!
This does the trick for me.
sudo npm install -g react-devtools --unsafe-perm=true
--unsafe-perm=true works for me, thanks Peoples.
https://geedew.com/What-does-unsafe-perm-in-npm-actually-do/
This does the trick for me.
sudo npm install -g react-devtools --unsafe-perm=true
jedi
Faced same issue, tried several answers found on the web and the solution provided by @brancooo1 worked like a charm, thanks bro.
sudo npm install -g react-devtools --unsafe-perm=true
you need to change the node_modules permission to all users
1- cd /usr/local/lib/
2- sudo chmod 777 node_modules
3- npm install -g react-devtools
that should fix it.
it's better to look at this link it's work
https://askubuntu.com/questions/869168/node-modules-have-755-permissions-what-permissions-should-i-set-so-that-npm-don?newreg=2327c9ea958d461d88c5d7f4f197b678
Most helpful comment
This does the trick for me.
sudo npm install -g react-devtools --unsafe-perm=true