Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

cannot npm install react-devtools #741

Closed
AdrienLemaire opened this issue May 25, 2017 · 29 comments
Closed

cannot npm install react-devtools #741

AdrienLemaire opened this issue May 25, 2017 · 29 comments

Comments

@AdrienLemaire
Copy link

Running:

$ sudo npm install -g react-devtools

Hangs when trying to install electron. Can be reproduced with $ npm install electron.

@AdrienLemaire
Copy link
Author

installing electron with my package manager, then reinstalling react-devtools seems to work

@AdrienLemaire
Copy link
Author

AdrienLemaire commented May 25, 2017

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)

@gaearon
Copy link
Contributor

gaearon commented May 26, 2017

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.

@AdrienLemaire
Copy link
Author

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
└─┬ react-devtools@2.2.1 
  ├─┬ electron@1.6.10 
  │ └── @types/node@7.0.22 
  └── react-devtools-core@2.2.1 

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

@gaearon
Copy link
Contributor

gaearon commented May 29, 2017

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.

@bvaughn
Copy link
Contributor

bvaughn commented Jun 1, 2017

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.

@AdrienLemaire
Copy link
Author

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.

@AlexanderKosianchuk
Copy link

chown USER:root /usr/lib/node_modules/ resolves "EACCES: permission denied, access /usr/lib/node_module"

@lpetkovic
Copy link

Been having the same issue (wasn't using sudo for npm i), resolved it by globally installing electron and then react-devtools.

@ghost
Copy link

ghost commented Sep 14, 2017

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:
screen shot 2017-09-14 at 11 15 05 am
For me it was done within 5 minutes, and then $ react-devtools works.

@brancooo1
Copy link

This does the trick for me.

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

@enriquesime
Copy link

@ghost Thanks that solve the issue !!!

@shafiqueqadri
Copy link

@brancooo1 Thanks your solution works for me.

@vink1987
Copy link

vink1987 commented Mar 19, 2018

@brancooo1 thanks ... it works 👍

@peterfei
Copy link

peterfei commented Apr 3, 2018

@ghost thanks a lot!

@mckmarc
Copy link

mckmarc commented Apr 11, 2018

@brancooo1 yeah

@alitsvin
Copy link

alitsvin commented May 16, 2018

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

@aino-gautam
Copy link

after trying all other options - this one worked as pointed out by @brancooo1

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

@min9nim
Copy link

min9nim commented Aug 27, 2018

adding --unsafe-perm=true option is work for me

thanks for @brancooo1

@bbmattieu9
Copy link

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

@behnammodi
Copy link

@brancooo1 thank's

@iamdylanngo
Copy link

@serpel
Copy link

serpel commented Nov 20, 2018

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

The real solution!

@Ethanng329
Copy link

This does the trick for me.

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

@PrimeTime416
Copy link

--unsafe-perm=true works for me, thanks Peoples.

https://geedew.com/What-does-unsafe-perm-in-npm-actually-do/

@rudiss
Copy link

rudiss commented Mar 14, 2019

This does the trick for me.

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

jedi

@gonpeche
Copy link

gonpeche commented Apr 16, 2019

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

@nawartamawi
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests