bash: npm: command not found in Debian 9.3

Orlando Cartagena picture Orlando Cartagena · Feb 23, 2018 · Viewed 30.3k times · Source

I am using Debian 9.3. (stretch) I cannot run "npm" commands.

Output for node -v

bash: node: command not found

Output for nodejs -v

v4.8.2

Output for npm -v

bash: npm: command not found

I'm a newbie on Debian and I can't understand what's happening.
- I already reinstall Node.js
- I already tried following the steps of the Official Page.
- I already ran apt-get install npm Output E: Unable to locate package npm.
- I was at Debian Testing and have the same error when I was there.

Thanks for read and help
- Melt

Answer

Diogo Jesus picture Diogo Jesus · Feb 23, 2018

Did you installed node js from their website? if that's not the case remove it apt-get remove nodejs and install it from this link (follow this steps) https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions


EDIT

After seing your version i realized that you are running an older version of nodejs... please remove the current nodejs version (V4.8.2) and install it via this link https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions It will give you the last version (mine is V9.2.0) with NPM installed aswell.