How come npm install doesn't work on git bash How come npm install doesn't work on git bash shell shell

How come npm install doesn't work on git bash


In our case, the solution was simply to close the Git bash window and re-open it.


In git bash type ...

which npm

This will tell you where npm is installed.

Now, I'm assuming this will give you nothing since it seems npm is not on your system PATH variable. The PATH variable defines where Windows looks for commands.

Go into your control panel and click system advanced settings and add the directory containing npm to your path.

If you dont know where it is then open a normal windows console and type ...

where npm

This will show you where it is so you can add it to your path.

Then close your git bash terminal and reopen it and npm should work.

PS if you want to check the PATH variable inside git bash, make sure the correct npm folder is on the PATH then just type ...

echo $PATH

PPS Another tip - you can tweak the PATH for git bash only via your .bashrc OR .bash_profile files.


If you are on Windows, try this:In CMD, go to folder

C:\Program Files or (x86)\nodejs\

Then try the following

C:\Program Files\nodejs>set path=%PATH%;%CD%C:\Program Files\nodejs>setx path "%PATH%"

It works for me!