3

When I check the version of Node, it says

v8.0.0

but when I check the version of NPM, it says

bash: npm: command not found

Previously, my action was

npm install -g "@angular/cli"

That's when it consistently shows the npm: command not found message.

I tried searching for possible solutions but none worked like the brew and others.

3
  • Related: stackoverflow.com/questions/26125358/… Commented Jun 8, 2017 at 3:55
  • This means that npm is not available in global path. export npm(if it was installed properly) directory to path and it should work. Commented Jun 8, 2017 at 4:02
  • try with a more recent version of node like 10.x Commented Jan 29, 2020 at 15:32

5 Answers 5

8

The npm file should be in /usr/local/bin/npm. If it's not there, install node.js again with the package on their website. This worked in my case.

Sign up to request clarification or add additional context in comments.

Comments

1

I have understand your problem, you have installed node and as well as you can install node legacy and npm. follow below commands you will easily solve

sudo apt-get remove npm, sudo apt-get remove nodejs-legacy, sudo apt-get remove nodejs , sudo rm /usr/bin/node , sudo apt-get install nodejs , sudo apt-get install nodejs-legacy , sudo apt-get install npm.

Comments

1

Solved with this:

npm config set prefix /usr/local

Comments

0

I had the same problem in Webstorm terminal in Windows 10 (but it worked in CMD and Powershell) when using NVM.

$ npm
bash: npm: command not found

I installed a new Node version (I think that will works too even if you are not using NVM) and used it. And NPM was available again

$ nvm install 8.11.2
$ npm use 8.11.2
$ npm -v
5.6.0

Hope it helps.

Comments

-5

I think your laptop have password. so, to install npm you have to run : sudo npm install and then enter your laptop password

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.