New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning "root" does not have permission to access the dev dir #454

Closed
tjwebb opened this Issue Jun 7, 2014 · 66 comments

Comments

Projects
None yet
@tjwebb

tjwebb commented Jun 7, 2014

For people coming here through search engines, see #454 (comment)

gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/travis/.node-gyp/0.10.28"

I'm filing this here because node-gyp is the only package that seems to throw this issue. My project depends on some modules which build with node-gyp, and I see this warning for every one of them during 'npm install'. Does anyone have insight on what this warning means?

@tjwebb tjwebb changed the title from "root" does not have permission to access the dev dir to Warning "root" does not have permission to access the dev dir Jun 7, 2014

@ferdi24

This comment has been minimized.

Show comment
Hide comment
@ferdi24

ferdi24 Jun 23, 2014

[help] same with me....

ferdinan@ferdinan:~/Documents/aplikasi-saya$ sudo npm install -g yo
[sudo] password for ferdinan: 

> fullname-native@0.1.1 install /usr/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native
> node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: EPERM, utime '/home/ferdinan/.node-gyp/0.10.29'
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>
npm WARN optional dep failed, continuing fullname-native@0.1.1

anybody can help me to solved...!!!

ferdi24 commented Jun 23, 2014

[help] same with me....

ferdinan@ferdinan:~/Documents/aplikasi-saya$ sudo npm install -g yo
[sudo] password for ferdinan: 

> fullname-native@0.1.1 install /usr/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native
> node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: EPERM, utime '/home/ferdinan/.node-gyp/0.10.29'
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>
npm WARN optional dep failed, continuing fullname-native@0.1.1

anybody can help me to solved...!!!

@mhintz

This comment has been minimized.

Show comment
Hide comment
@mhintz

mhintz Jul 7, 2014

Yep, I'm getting a very similar error. In my case, it happens after running:

npm install grunt-browserify

I get:

fsevents@0.2.0 install <directory_name>/node_modules/grunt-browserify/node_modules/watchify/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp WARN EACCES user "" does not have permission to access the dev dir "/<my root user directory, (~)>/.node-gyp/0.10.29"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/folders/_c/0g7gkjgs3_955vxcyp7y5xc40000gn/T/.node-gyp"
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
SOLINK_MODULE(target) Release/fse.node: Finished

After that, I get the usual npm module installed boilerplate.

I get the same message when I run the command with root privileges, except with 'user "root" does not have permission...'

This error began happening after I upgraded node from version 0.10.21 to version 0.10.29 using the install package at http://nodejs.org/. I can see that the folder it's expecting, ~/.node-gyp/0.10.29, doesn't exist. If it helps, I'm running Mac OS X 10.9.3.

I wish I knew more about the project and could suggest a fix, but I thought I'd post, just to bring it to your attention.

Cheers!

mhintz commented Jul 7, 2014

Yep, I'm getting a very similar error. In my case, it happens after running:

npm install grunt-browserify

I get:

fsevents@0.2.0 install <directory_name>/node_modules/grunt-browserify/node_modules/watchify/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp WARN EACCES user "" does not have permission to access the dev dir "/<my root user directory, (~)>/.node-gyp/0.10.29"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/folders/_c/0g7gkjgs3_955vxcyp7y5xc40000gn/T/.node-gyp"
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
SOLINK_MODULE(target) Release/fse.node: Finished

After that, I get the usual npm module installed boilerplate.

I get the same message when I run the command with root privileges, except with 'user "root" does not have permission...'

This error began happening after I upgraded node from version 0.10.21 to version 0.10.29 using the install package at http://nodejs.org/. I can see that the folder it's expecting, ~/.node-gyp/0.10.29, doesn't exist. If it helps, I'm running Mac OS X 10.9.3.

I wish I knew more about the project and could suggest a fix, but I thought I'd post, just to bring it to your attention.

Cheers!

@mhintz

This comment has been minimized.

Show comment
Hide comment
@mhintz

mhintz Jul 7, 2014

Update: as expected, everything works fine and I have no warning if I just change the name of the folder at ~/.node-gyp/0.10.21 to 0.10.29, matching my version change. I suspect those of you on Linux having a similar problem could make a similar fix. Hope it's not gonna break anything under the hood...

mhintz commented Jul 7, 2014

Update: as expected, everything works fine and I have no warning if I just change the name of the folder at ~/.node-gyp/0.10.21 to 0.10.29, matching my version change. I suspect those of you on Linux having a similar problem could make a similar fix. Hope it's not gonna break anything under the hood...

@kulicuu

This comment has been minimized.

Show comment
Hide comment
@kulicuu

kulicuu Jul 7, 2014

If I remember correctly, set unsafe-perm to true when running as sudo is a fix it's obstructing.

kulicuu commented Jul 7, 2014

If I remember correctly, set unsafe-perm to true when running as sudo is a fix it's obstructing.

@djensen47

This comment has been minimized.

Show comment
Hide comment
@djensen47

djensen47 Jul 23, 2014

I'm also seeing this on SmartOS/illumos/Solaris

djensen47 commented Jul 23, 2014

I'm also seeing this on SmartOS/illumos/Solaris

@tomascharad

This comment has been minimized.

Show comment
Hide comment
@tomascharad

tomascharad Sep 28, 2014

+1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/XXX/.node-gyp/0.10.32"

tomascharad commented Sep 28, 2014

+1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/XXX/.node-gyp/0.10.32"

@tjwebb

This comment has been minimized.

Show comment
Hide comment
@tjwebb

tjwebb Sep 28, 2014

Doesn't look like the project maintainer cares much about this issue

tjwebb commented Sep 28, 2014

Doesn't look like the project maintainer cares much about this issue

@tomascharad

This comment has been minimized.

Show comment
Hide comment
@tomascharad

tomascharad Sep 28, 2014

I solved it by using chown on the .node-gyp folder and cleaning cache if I remember correctly.

tomascharad commented Sep 28, 2014

I solved it by using chown on the .node-gyp folder and cleaning cache if I remember correctly.

@BaggersIO

This comment has been minimized.

Show comment
Hide comment
@BaggersIO

BaggersIO Oct 11, 2014

Same problem here. Using Ubuntu 14.04. chown on the node-gyp folder did not fix the issue :(

BaggersIO commented Oct 11, 2014

Same problem here. Using Ubuntu 14.04. chown on the node-gyp folder did not fix the issue :(

@BaggersIO

This comment has been minimized.

Show comment
Hide comment
@BaggersIO

BaggersIO Oct 12, 2014

Solved it be adding --unsafe-perm.

In my case with sails:

sudo npm install --unsafe-perm --verbose -g sails

Works well!

BaggersIO commented Oct 12, 2014

Solved it be adding --unsafe-perm.

In my case with sails:

sudo npm install --unsafe-perm --verbose -g sails

Works well!

@herrdu

This comment has been minimized.

Show comment
Hide comment
@herrdu

herrdu Oct 18, 2014

why should I set 'unsafe-perm ' =true ,what's the meaning of "unsafe-perm"?

herrdu commented Oct 18, 2014

why should I set 'unsafe-perm ' =true ,what's the meaning of "unsafe-perm"?

@herrdu

This comment has been minimized.

Show comment
Hide comment
@herrdu

herrdu Oct 18, 2014

I met the same problem
"2:~ herrdu$ sudo npm install -g hexo
Password:
Sorry, try again.
Password:

fsevents@0.2.0 install /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/herrdu/.node-gyp/0.10.32"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents/.node-gyp"
"
Do you find the solution?And can you show it in detail ?

herrdu commented Oct 18, 2014

I met the same problem
"2:~ herrdu$ sudo npm install -g hexo
Password:
Sorry, try again.
Password:

fsevents@0.2.0 install /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/herrdu/.node-gyp/0.10.32"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents/.node-gyp"
"
Do you find the solution?And can you show it in detail ?

@herrdu

This comment has been minimized.

Show comment
Hide comment
@herrdu

herrdu Oct 18, 2014

And if I create the direction ".node-gyp herrdu$ mrdir 0.10.32" ,the error is

fsevents@0.2.0 install /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: EPERM, chmod '/Users/herrdu/.node-gyp/0.10.32'
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! This is a bug in node-gyp.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! https://github.com/TooTallNate/node-gyp/issues
npm WARN optional dep failed, continuing fsevents@0.2.0'

Then I can't solve it!!!

herrdu commented Oct 18, 2014

And if I create the direction ".node-gyp herrdu$ mrdir 0.10.32" ,the error is

fsevents@0.2.0 install /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: EPERM, chmod '/Users/herrdu/.node-gyp/0.10.32'
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/hexo/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! This is a bug in node-gyp.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! https://github.com/TooTallNate/node-gyp/issues
npm WARN optional dep failed, continuing fsevents@0.2.0'

Then I can't solve it!!!

@Jakobud

This comment has been minimized.

Show comment
Hide comment
@Jakobud

Jakobud Oct 29, 2014

How come this is still an outstanding issue? Why is gyp even used by NPM if it's this broken with no clear solution? I've seen people recommend rm -rf ~/tmp and using --unsafe-perm but those haven't made a difference for me on my CentOS server.

Jakobud commented Oct 29, 2014

How come this is still an outstanding issue? Why is gyp even used by NPM if it's this broken with no clear solution? I've seen people recommend rm -rf ~/tmp and using --unsafe-perm but those haven't made a difference for me on my CentOS server.

@fooooorrest

This comment has been minimized.

Show comment
Hide comment
@fooooorrest

fooooorrest Jan 7, 2015

This error occurred for me when trying to install player and other libraries that depended on speaker.
I got it to work by first installing libasound2-dev with:
$ sudo apt-get install libasound2-dev
Then installed speaker with :
sudo npm install --unsafe-perm --verbose -g speaker
and finally installed player with
sudo npm install --unsafe-perm --verbose -g player

Looks good from the console output, but I haven't tried to play a file yet.

fooooorrest commented Jan 7, 2015

This error occurred for me when trying to install player and other libraries that depended on speaker.
I got it to work by first installing libasound2-dev with:
$ sudo apt-get install libasound2-dev
Then installed speaker with :
sudo npm install --unsafe-perm --verbose -g speaker
and finally installed player with
sudo npm install --unsafe-perm --verbose -g player

Looks good from the console output, but I haven't tried to play a file yet.

@apollolm

This comment has been minimized.

Show comment
Hide comment
@apollolm

apollolm Jan 7, 2015

FWIW - sudo npm install --unsafe-perm solved this problem for me as well on Ubuntu 14.04, Node 0.10.24.

apollolm commented Jan 7, 2015

FWIW - sudo npm install --unsafe-perm solved this problem for me as well on Ubuntu 14.04, Node 0.10.24.

@jyoungrok

This comment has been minimized.

Show comment
Hide comment
@jyoungrok

jyoungrok Mar 25, 2015

After removing /root/.node-gyp, sudo npm install --unsafe-perm --verbose -g solved this problem

jyoungrok commented Mar 25, 2015

After removing /root/.node-gyp, sudo npm install --unsafe-perm --verbose -g solved this problem

@donaldpipowitch

This comment has been minimized.

Show comment
Hide comment
@donaldpipowitch

donaldpipowitch Mar 26, 2015

I have a similar problem reported here: npm/npm#7764. Is this a problem with npm or node-gyp? No solution solved my problem. When I use --unsafe-perm I get rid of all error messages, but the installation process runs endlessly.

donaldpipowitch commented Mar 26, 2015

I have a similar problem reported here: npm/npm#7764. Is this a problem with npm or node-gyp? No solution solved my problem. When I use --unsafe-perm I get rid of all error messages, but the installation process runs endlessly.

@cliveb

This comment has been minimized.

Show comment
Hide comment
@cliveb

cliveb Apr 8, 2015

At node school, similar issue.
$ sudo npm install -g stream-adventure
npm-debug-log

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '--unsafe-perm',
1 verbose cli '--verbose',
1 verbose cli '-g' ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 silly cache add args [ '.', null ]
5 verbose cache add spec .
6 silly cache add parsed spec { raw: '.',
6 silly cache add scope: null,
6 silly cache add name: null,
6 silly cache add rawSpec: '.',
6 silly cache add spec: '/Users/seebe',
6 silly cache add type: 'local' }
7 error addLocal Could not install /Users/seebe
8 verbose stack Error: EISDIR, read
8 verbose stack at Error (native)
9 verbose cwd /Users/seebe
10 error Darwin 13.4.0
11 error argv "node" "/usr/local/bin/npm" "install" "--unsafe-perm" "--verbose" "-g"
12 error node v0.12.2
13 error npm v2.7.4
14 error code EISDIR
15 error errno -21
16 error EISDIR, read
17 error If you need help, you may report this error at:
17 error https://github.com/npm/npm/issues
18 verbose exit [ -21, true ]

cliveb commented Apr 8, 2015

At node school, similar issue.
$ sudo npm install -g stream-adventure
npm-debug-log

0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '--unsafe-perm',
1 verbose cli '--verbose',
1 verbose cli '-g' ]
2 info using npm@2.7.4
3 info using node@v0.12.2
4 silly cache add args [ '.', null ]
5 verbose cache add spec .
6 silly cache add parsed spec { raw: '.',
6 silly cache add scope: null,
6 silly cache add name: null,
6 silly cache add rawSpec: '.',
6 silly cache add spec: '/Users/seebe',
6 silly cache add type: 'local' }
7 error addLocal Could not install /Users/seebe
8 verbose stack Error: EISDIR, read
8 verbose stack at Error (native)
9 verbose cwd /Users/seebe
10 error Darwin 13.4.0
11 error argv "node" "/usr/local/bin/npm" "install" "--unsafe-perm" "--verbose" "-g"
12 error node v0.12.2
13 error npm v2.7.4
14 error code EISDIR
15 error errno -21
16 error EISDIR, read
17 error If you need help, you may report this error at:
17 error https://github.com/npm/npm/issues
18 verbose exit [ -21, true ]

c9s added a commit to c9s/typeloy that referenced this issue Dec 5, 2016

c9s added a commit to c9s/typeloy that referenced this issue Dec 7, 2016

mcny added a commit to mcny/sh that referenced this issue Jun 21, 2017

Update dply.sh
i hate npm so much nodejs/node-gyp#454

@mcny mcny referenced this issue Jun 21, 2017

Merged

Update dply.sh #5

@DanielRuf

This comment has been minimized.

Show comment
Hide comment
@DanielRuf

DanielRuf Jul 16, 2017

It seems this is still not fixed =(

DanielRuf commented Jul 16, 2017

It seems this is still not fixed =(

@gibfahn

This comment has been minimized.

Show comment
Hide comment
@gibfahn

gibfahn Jul 16, 2017

Member

It seems this is still not fixed =(

"Don't install node/npm as root" is the fix. The issue you're seeing (see #454 (comment)) is that npm doesn't like to run as root, if you want to change that then feel free to file an issue with npm (or just search their issues, I'm sure lots of people have complained before): https://github.com/npm/npm/issues

If you're seeing this without having used sudo then let us know.

Member

gibfahn commented Jul 16, 2017

It seems this is still not fixed =(

"Don't install node/npm as root" is the fix. The issue you're seeing (see #454 (comment)) is that npm doesn't like to run as root, if you want to change that then feel free to file an issue with npm (or just search their issues, I'm sure lots of people have complained before): https://github.com/npm/npm/issues

If you're seeing this without having used sudo then let us know.

@DanielRuf

This comment has been minimized.

Show comment
Hide comment
@DanielRuf

DanielRuf Jul 16, 2017

I'm not sure why this should be the right solution.

Also see https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

You do not come far without sudo ;-)

DanielRuf commented Jul 16, 2017

I'm not sure why this should be the right solution.

Also see https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

You do not come far without sudo ;-)

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Jul 16, 2017

Member

Installing node or npm with sudo, sure. But running them as root? Should never be necessary.

Member

bnoordhuis commented Jul 16, 2017

Installing node or npm with sudo, sure. But running them as root? Should never be necessary.

@DanielRuf

This comment has been minimized.

Show comment
Hide comment
@DanielRuf

DanielRuf Jul 16, 2017

Installing node or npm with sudo, sure. But running them as root? Should never be necessary.

Guess what, the problem occurs when I install without sudo (I did not install the package with sudo). The unsafe-perm flag was the only reliable solution here. ;-)

DanielRuf commented Jul 16, 2017

Installing node or npm with sudo, sure. But running them as root? Should never be necessary.

Guess what, the problem occurs when I install without sudo (I did not install the package with sudo). The unsafe-perm flag was the only reliable solution here. ;-)

@DanielRuf

This comment has been minimized.

Show comment
Hide comment
@DanielRuf

DanielRuf Jul 16, 2017

#454 (comment)
#454 (comment)
#454 (comment)
#454 (comment)

The problem occurs with node 6 and npm 3 on a Debian 8 root server when I try to install sitespeed.io. With a normal npm install -g sitespeed.io command. Nothing special on my side.

DanielRuf commented Jul 16, 2017

#454 (comment)
#454 (comment)
#454 (comment)
#454 (comment)

The problem occurs with node 6 and npm 3 on a Debian 8 root server when I try to install sitespeed.io. With a normal npm install -g sitespeed.io command. Nothing special on my side.

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Jul 16, 2017

Member

Let me rephrase: if it doesn't work without root, chances are you are doing something wrong.

If npm install -g in your case means 'install to /usr/local', ask yourself why /usr/local and not your home directory. Node, npm and node-gyp don't mandate that packages are installed system-wide.

If sitespeed.io does, that's a bug in that package, but you are in the wrong bug tracker in that case.

Member

bnoordhuis commented Jul 16, 2017

Let me rephrase: if it doesn't work without root, chances are you are doing something wrong.

If npm install -g in your case means 'install to /usr/local', ask yourself why /usr/local and not your home directory. Node, npm and node-gyp don't mandate that packages are installed system-wide.

If sitespeed.io does, that's a bug in that package, but you are in the wrong bug tracker in that case.

@gibfahn

This comment has been minimized.

Show comment
Hide comment
@gibfahn

gibfahn Jul 17, 2017

Member

@DanielRuf see the npm help pages, which go into this quite exhaustively: https://docs.npmjs.com/getting-started/fixing-npm-permissions

Note that this is still nothing to do with node-gyp.

Member

gibfahn commented Jul 17, 2017

@DanielRuf see the npm help pages, which go into this quite exhaustively: https://docs.npmjs.com/getting-started/fixing-npm-permissions

Note that this is still nothing to do with node-gyp.

@DanielRuf

This comment has been minimized.

Show comment
Hide comment
@DanielRuf

DanielRuf Jul 17, 2017

Well, I tried option 2 with the custom path / directory and it did not fix the issue. And I think I also tried option 1 too but npm always reset the directory. Anyway, I got it working with the unsafe-perm flag.

DanielRuf commented Jul 17, 2017

Well, I tried option 2 with the custom path / directory and it did not fix the issue. And I think I also tried option 1 too but npm always reset the directory. Anyway, I got it working with the unsafe-perm flag.

@gibfahn

This comment has been minimized.

Show comment
Hide comment
@gibfahn

gibfahn Jul 17, 2017

Member

For anyone else coming across this thread, I recommend just using nvm, which avoids these issues. Using --unsafe-perm (running random module install scripts as root) is a pretty terrible idea.


Well, I tried option 2 with the custom path / directory and it did not fix the issue.

A global modules directory that is owned by the user (not by root) is the default for every install method that isn't a Linux package manager, and it works fine.

npm always reset the directory

Unless you're still running with sudo npm then I've never known it do that. Difficult to debug without more info though.

Member

gibfahn commented Jul 17, 2017

For anyone else coming across this thread, I recommend just using nvm, which avoids these issues. Using --unsafe-perm (running random module install scripts as root) is a pretty terrible idea.


Well, I tried option 2 with the custom path / directory and it did not fix the issue.

A global modules directory that is owned by the user (not by root) is the default for every install method that isn't a Linux package manager, and it works fine.

npm always reset the directory

Unless you're still running with sudo npm then I've never known it do that. Difficult to debug without more info though.

@tbaltrushaitis

This comment has been minimized.

Show comment
Hide comment
@tbaltrushaitis

tbaltrushaitis Jul 20, 2017

I recommend just using nvm

1️⃣ Install with a line of code
2️⃣ Use

$ nvm ls
$ nvm ls-remote
$ nvm install
$ nvm use
$ nvm exec

Enjoy your life ;-)

tbaltrushaitis commented Jul 20, 2017

I recommend just using nvm

1️⃣ Install with a line of code
2️⃣ Use

$ nvm ls
$ nvm ls-remote
$ nvm install
$ nvm use
$ nvm exec

Enjoy your life ;-)

@elliott-beach

This comment has been minimized.

Show comment
Hide comment
@elliott-beach

elliott-beach Jul 22, 2017

The configuration of global packages should be up to the devloper and npm, which defaults to /usr/local/ for Linux. This package should work with those settings, or at least show a comprehensible error message, instead of runing an infinite loop of attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-inspector/node_modules/v8-profiler/.node-gyp".

elliott-beach commented Jul 22, 2017

The configuration of global packages should be up to the devloper and npm, which defaults to /usr/local/ for Linux. This package should work with those settings, or at least show a comprehensible error message, instead of runing an infinite loop of attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-inspector/node_modules/v8-profiler/.node-gyp".

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Jul 24, 2017

Member

@e-beach Have you actually read through the issue or is yours just a pile-up comment?

Member

bnoordhuis commented Jul 24, 2017

@e-beach Have you actually read through the issue or is yours just a pile-up comment?

@Davenchy

This comment has been minimized.

Show comment
Hide comment
@Davenchy

Davenchy Jul 30, 2017

Try
sudo npm install -g PackageName --allow-root

Davenchy commented Jul 30, 2017

Try
sudo npm install -g PackageName --allow-root

@JSAbrahams

This comment has been minimized.

Show comment
Hide comment
@JSAbrahams

JSAbrahams Aug 12, 2017

@Davenchy Nope didn't work.

JSAbrahams commented Aug 12, 2017

@Davenchy Nope didn't work.

@jasmeetdd

This comment has been minimized.

Show comment
Hide comment
@jasmeetdd

jasmeetdd Sep 18, 2017

@Davenchy
Thanks buddy!
This:-
sudo npm install -g PackageName --allow-root
Dis the trick for me on CentOS with cPanel.

jasmeetdd commented Sep 18, 2017

@Davenchy
Thanks buddy!
This:-
sudo npm install -g PackageName --allow-root
Dis the trick for me on CentOS with cPanel.

@Extarys

This comment has been minimized.

Show comment
Hide comment
@Extarys

Extarys Sep 19, 2017

Same issue here with angular.

sudo npm i -g @angular/cli --allow-root Did the trick.

Never had issue with npm and node before and now with clean os I had so many issues in the last two hours I cant believe it.

Extarys commented Sep 19, 2017

Same issue here with angular.

sudo npm i -g @angular/cli --allow-root Did the trick.

Never had issue with npm and node before and now with clean os I had so many issues in the last two hours I cant believe it.

@manmohanbishnoi

This comment has been minimized.

Show comment
Hide comment
@manmohanbishnoi

manmohanbishnoi Sep 21, 2017

Issue on Ubuntu 16.04.2 LTS when using
sudo npm install -g @angular/cli --allow-root

This one fixed the errors and installation completed successfully
sudo npm install --unsafe-perm -g @angular/cli

manmohanbishnoi commented Sep 21, 2017

Issue on Ubuntu 16.04.2 LTS when using
sudo npm install -g @angular/cli --allow-root

This one fixed the errors and installation completed successfully
sudo npm install --unsafe-perm -g @angular/cli

@nodejs nodejs locked and limited conversation to collaborators Sep 21, 2017

@bnoordhuis

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Sep 21, 2017

Member

I've taken the liberty of locking this because it's turning into one of those undead issues that attract comments long after its expiry date.

For people coming here through search engines, see #454 (comment).

Member

bnoordhuis commented Sep 21, 2017

I've taken the liberty of locking this because it's turning into one of those undead issues that attract comments long after its expiry date.

For people coming here through search engines, see #454 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.