thetrystero
thetrystero

Reputation: 6062

npm disappeared after running update

I was following a tutorial over at nettutsplus, and after running npm update -g npm, my npm no longer exists when i type which npm. here are the errors. what went wrong and how can i fix it?

localhost:~ macgeekalex$ npm update -g npm
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.3.1.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.3.1.tgz
npm http GET https://registry.npmjs.org/npm/1.3.1
npm http 200 https://registry.npmjs.org/npm/1.3.1
npm http GET https://registry.npmjs.org/npm/-/npm-1.3.1.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.3.1.tgz
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back  [email protected] { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/npm' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! cwd /Volumes/Prodigy RAIDER PRO/Users/macgeekalex
npm ERR! node -v v0.10.12
npm ERR! npm -v 1.2.32
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Volumes/Prodigy RAIDER PRO/Users/macgeekalex/npm-debug.log
npm ERR! not ok code 0

Upvotes: 14

Views: 12006

Answers (1)

user568109
user568109

Reputation: 47993

See the FAQ

How do I update npm?

npm update npm -g

npm update npm -g You can also update all outdated local packages by doing npm update without any arguments, or global packages by doing npm update -g.

Occasionally, the version of npm will progress such that the current version cannot be properly installed with the version that you have installed already. (Consider, if there is ever a bug in the update command.)

In those cases, you can do this:

curl https://npmjs.org/install.sh | sh

Update

The install script location has been moved since, so try:

curl -L https://npmjs.org/install.sh | sh

Upvotes: 19

Related Questions