Reputation: 8928
I installed Node on El Capitan using the package from their website.
I check to see if npm
is installed and it shows version 2.15.5
is installed.
I then routinely check to see if there's an update and accidentally forget to use sudo
. I retry again using sudo
and it fails saying npm
command isn't found.
Both which npm
and whereis npm
fail to return anything.
What's going on?
Upvotes: 1
Views: 215
Reputation: 24604
Well, your npm upgrade failed, which means that either:
the symlink /usr/local/bin/npm that pointed to the actual script was removed, but it failed when trying to remove the actual npm files and hence, never reinstalled a new symlink
the /usr/local/lib/node_modules/npm stuff actually got removed, but not the folder, hence the upgrade failed.
npm should point like this from /usr/local/bin:
npm -> ../lib/node_modules/npm/bin/npm-cli.js
Hope that helps. If the actual npm-cli.js file is actually gone, your best bet is to just re-install node and then upgrade with sudo.
Upvotes: 2