Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash: npm: command not found?

I'm learning laravel and follwing this tutorial,

But when I went try and install npm, is says bash: npm: command not found

enter image description here

like image 967
Deo Avatar asked Aug 09 '17 08:08

Deo


People also ask

How do I fix npm not found?

two steps to do is to (1) which node (2) which npm which should be both in /usr/local/bin (where homebrew installs/symlinks node+npm)... to resolve.. try (1) brew doctor (2) brew reinstall node if its still giving issues.. check your path (echo $PATH).

Why is npm v not working?

On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

Can you run npm in Git bash?

In git Bash, a Linux like environement is simulated so you can access your Linux filesystem with Linux style paths. Type then node --version and npm --version to check that node and npm are available.

Where is npm installed?

npm install -g pm2 - pm2 will be installed globally. It will then typically be found in /usr/local/lib/node_modules (Use npm root -g to check where.) If you're using nvm, then your global modules may be in one of several places depending on the version of node you're using at the time.


3 Answers

If you have already installed nodejs and still getting this error. npm: command not found..

run this

apt-get install -y npm
like image 78
Black Mask Avatar answered Oct 06 '22 19:10

Black Mask


I also come here for the same problem, The solution I found is to install npm and then restart the Visual Studio Code

like image 23
Naimur Hasan Avatar answered Oct 06 '22 21:10

Naimur Hasan


in redhat base OS (tested in centos 7)

yum install nodejs npm -y

in debian base OS

apt-get install -y npm    
like image 7
Omid Ahmadyani Avatar answered Oct 06 '22 21:10

Omid Ahmadyani