Matt Leach
Matt Leach

Reputation: 979

npm install -g when using nvm

I'm using nvm to be able to switch node versions but when I try and install a global package with npm install -g it keeps installing to /Users/<username>/.nvm/versions/node/v8.9.4/bin/ even though doing node -v shows version 9.10.0

Basically when I change node version using nvm use ... I want my global packages to go to the correct node version.

Thanks for any help

Upvotes: 7

Views: 22916

Answers (1)

iCantFindaGoodUsername
iCantFindaGoodUsername

Reputation: 816

The issue can most probably be with the NodeJS installation via nvm or the nvm.

The best solution can be to completely uninstall the nvm ( which'll eventually remove NodeJS alongside npm and if not, manually remove it using synaptic package manager or terminal) and reinstall it again.

To remove nvm:

sudo apt-get remove nvm && sudo apt-get purge nvm

To reinstall nvm again,

follow this link

Upvotes: 0

Related Questions