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
To use the official Node installer for reinstalling the tools, go to the Node. js download page and select the version you want to install—just as we described previously. Remember to choose the macOS installer option. If you run the installer, it will complete the reinstallation process for you automatically.
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With