Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Command Not Found

Tags:

bash

node.js

npm

I just updated node (through the nodejs.org package installer) and now npm won't work.

npm: command not found

Any idea what's going on?

like image 555
Connor Black Avatar asked May 13 '13 20:05

Connor Black


People also ask

How do I fix npm command not found?

The npm command not found error js server, which you can download from the nodejs.org website. Once you downloaded and installed Node. js, open the terminal and run the npm -v command. Once you see the npm version, you should be able to run the npm install command again.

Why can't I install npm?

The Npm command not found error can appear when you install or upgrade npm. 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.


2 Answers

I was hung up on this too. I installed node via nvm and could not run npm or node. I had to run nvm use 0.10.10

then which node and which npm worked again.

if you have installed npm via nvm you might want to add nvm use <version> to your .bashrc file so that you'll have npm always available on any shell you open. You just need to remember to update it whenever you update npm, or use stable.

like image 106
JimBtek Avatar answered Sep 19 '22 08:09

JimBtek


It could be a permission issue as well. If so you need to run this: sudo chown -R $USER /usr/local

This worked for me

like image 32
Rajesh Avatar answered Sep 21 '22 08:09

Rajesh