BugHunterUK BugHunterUK - 2 years ago 97
Node.js Question

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

is installed and it shows version
is installed.

I then routinely check to see if there's an update and accidentally forget to use
. I retry again using
and it fails saying
command isn't found.

which npm
whereis npm
fail to return anything.

What's going on?

enter image description here

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download