BugHunterUK
BugHunterUK

Reputation: 8928

NPM was installed. I attempt to update and find it's no longer installed

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?

enter image description here

Upvotes: 1

Views: 215

Answers (1)

jishi
jishi

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

Related Questions