Running `npm update -g` kills npm install #1972

jswartwood opened this Issue Dec 30, 2011 · 2 comments


None yet
2 participants

I'm running node v0.6.6 and npm v1.1.0-beta-4 (the npm bundled w/ node) on osx.

I thought that npm update -g should be able to update npm to the latest version, but instead it fails because of permissions (I'm not surprised about this) and breaks the installed npm in the process (this is the issue).

My output:

$ npm update -g
npm http GET
npm http 304
npm http GET
npm http 304
npm ERR! error installing npm@1.0.106
npm ERR! error rolling back npm@1.0.106 Error: EACCES, permission denied '/usr/local/lib/node_modules/npm/.gitmodules'
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/npm/.gitmodules'
npm ERR! Report this *entire* log at:
npm ERR!     <>
npm ERR! or email it to:
npm ERR!     <>
npm ERR! 
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g"
npm ERR! cwd /Users/jswartwood
npm ERR! node -v v0.6.6
npm ERR! npm -v 1.1.0-beta-4
npm ERR! path /usr/local/lib/node_modules/npm/.gitmodules
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/npm/.gitmodules'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jswartwood/npm-debug.log
npm not ok
$ npm
-bash: /usr/local/bin/npm: No such file or directory

The problem is solved via running with sudo instead...

$ sudo npm update -g
npm http GET
npm http 304
npm http GET
npm http 304
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npm_g -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npm-g -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.0.106 /usr/local/lib/node_modules/npm

...but the permissions problem should simply throw an error and fail gracefully, and not require a node/npm reinstall.

A quick search (probably should've done this first) for similar issues shows this bug may be a dupe of #1785 and possibly #1732 too. Hopefully my symptoms may help define the problem.


luk- commented Mar 13, 2013

Fix permissions so you're not ever using sudo to install things and this problem will vanish.

luk- closed this Mar 13, 2013

JohnMcLear referenced this issue in ether/etherpad-lite Mar 20, 2013


Service crash when viewing /admin/plugins #1635

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