Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Can't install anything #4719

Closed
ghost opened this issue Feb 19, 2014 · 14 comments
Closed

Can't install anything #4719

ghost opened this issue Feb 19, 2014 · 14 comments

Comments

@ghost
Copy link

ghost commented Feb 19, 2014

Any time I try to install something, I get a mega error. This is on Mac OS 10.8.

sudo npm install -g generator-angular-fullstack

npm ERR! Error: could not get uid/gid
npm ERR! [ 'nobody', 20 ]
npm ERR!
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:36:24
npm ERR!     at ChildProcess.exithandler (child_process.js:635:7)
npm ERR!     at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR!     at maybeClose (child_process.js:735:16)
npm ERR!     at Socket.<anonymous> (child_process.js:948:11)
npm ERR!     at Socket.EventEmitter.emit (events.js:95:17)
npm ERR!     at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "generator-angular-fullstack"
npm ERR! cwd /Users/bob
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.4.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/bob/npm-debug.log
npm ERR! not ok code 0
@Laurian
Copy link

Laurian commented Feb 19, 2014

Same, compiled and installed node 0.10.26 on Ubuntu 12.04; npm update dies:

root@dev:/opt/node-v0.10.26# npm update -g
npm ERR! Error: could not get uid/gid
npm ERR! [ 'nobody', 0 ]
npm ERR! 
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:36:24
npm ERR!     at ChildProcess.exithandler (child_process.js:635:7)
npm ERR!     at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR!     at maybeClose (child_process.js:743:16)
npm ERR!     at Process.ChildProcess._handle.onexit (child_process.js:810:5)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.2.0-54-virtual
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "update" "-g"
npm ERR! cwd /opt/node-v0.10.26
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /opt/node-v0.10.26/npm-debug.log
npm ERR! not ok code 0

Trying as non root a sudo npm update -g yields the same error, only difference is [ 'nobody', 1000 ] instead of [ 'nobody', 0 ]

@ghost
Copy link
Author

ghost commented Feb 19, 2014

Just wondering, and hopefully no one takes this the wrong way: Does any testing get carried out at all before releases are pushed out into the world? Having such a fundamental procedure fail like this seems strange.

@Laurian
Copy link

Laurian commented Feb 19, 2014

For now I just commented out line 36 of /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js to ignore the error and everything else worked fine afterwards.

I guess this issue should be filled with https://github.com/isaacs/uid-number

@ghost
Copy link
Author

ghost commented Feb 20, 2014

Did a totally clean install of node. Removed all previous traces of it completely before installing. Still doesn't work.

@neurobits
Copy link

Hi, same thing here, I had at least one of the possible ways to reproduce the issue. Consider that yesterday I had my npm installation broken, I deleted every 'node_modules' directory on my hardisk and do a clean node install (osx) alongside some npm packages. Today I did some 'npm update -g [package]' updates. Just after run 'sudo npm update -g uid-number' and get a clean update, I had repeated exactly the same update command by mistake. Inmediatly my npm get broken again. I copied the entire /usr/local/lib/node_modules/uid-number to /usr/local/lib/node_modules/npm/node_modules/uid-number. Unsucessfully.

npm ERR! Error: could not get uid/gid
npm ERR! [ 'nobody', 20 ]
npm ERR!
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:36:24
npm ERR! at ChildProcess.exithandler (child_process.js:635:7)
npm ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR! at maybeClose (child_process.js:743:16)
npm ERR! at Socket. (child_process.js:956:11)
npm ERR! at Socket.EventEmitter.emit (events.js:95:17)
npm ERR! at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "ls" "-g"
npm ERR! cwd /Users/neurobits
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/neurobits/npm-debug.log
npm ERR! not ok code 0

@danmactough
Copy link

What is the output of:

$ npm config get unsafe-perm

If it isn't true, try setting it to true with npm config set unsafe-perm true and trying again.

@neurobits
Copy link

Stop running npm as root with sudo. And worked ok, but just after set me as owner of /usr/local/lib/node_modules directory. Before I tried setting privileges to ug+rw and owner/group to root:staff (my user is staff's member, of course I verified that ;) )

@neurobits
Copy link

npm config get unsafe-perm --> true
sudo npm config get unsafe-perm --> false

Setting 'npm config set unsafe-perm true' worked ok. thanks a lot.

@danmactough
Copy link

Setting 'npm config set unsafe-perm true' worked ok. thanks a lot.

🎉 Not sure that's the best solution, but getting un-stuck is usually a big win!

@ghost
Copy link
Author

ghost commented Feb 20, 2014

I was under the impression that on Mac OS (and possibly Linux), when installing things globally with -g, you're supposed to use sudo. Is that not the case? If I run npm update -g, I get permissions errors because it can't write to /usr/local/lib/node_modules. I'm nearly positive this has to be run as root.

@ghost
Copy link
Author

ghost commented Feb 20, 2014

As a workaround for the permissions issue (having to use sudo), I just recursively chowned /usr/local/lib/node_modules to myself. Seems to work.

@msumme
Copy link

msumme commented Feb 20, 2014

sudo npm config set unsafe-perm true - also worked for me.

@isaacs
Copy link
Contributor

isaacs commented Feb 20, 2014

Root cause: npm/uid-number#3

Pushing a new npm now. Sorry about this.

@isaacs
Copy link
Contributor

isaacs commented Feb 20, 2014

If you are affected by this, you can run this script: https://gist.github.com/isaacs/9117286

The good news is that this bug didn't go out in the recent Node.js release, so you can also click the Big Green Button on http://nodejs.org and it should fix it for you.

@isaacs isaacs closed this as completed Feb 20, 2014
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

5 participants