NPM not found when using NVM

Raphaël picture Raphaël · Nov 23, 2015 · Viewed 28k times · Source

I have installed node/npm using the nvm documentation.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash

Then:

nvm install node

At this point node is working but the npm command result with:

npm: command not found

How can I have npm to work correctly ?

Answer

Raphaël picture Raphaël · Nov 23, 2015

I found out that this was a conflict with a previous versions of npm that have not been removed properly despite a apt-get remove node.

I solved it by reinstalling npm from scratch:

rm -R ~/.npm ~/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node

I found the solution here.