NVM global module folder

Juriy picture Juriy · Nov 20, 2015 · Viewed 30.8k times · Source

I am using NVM and I am trying to install global NPM modules. That action requires permissions to a folder that I don't have permissions to. With regular node.js/npm that was easy to solve with prefix configuration but NVM explicitly forbids it.

What is the right way to change the path to global modules folder in NVM?

Answer

majgis picture majgis · Dec 3, 2015

To see the location of the current version of node you are using:

nvm which current

You are using the system installation if .nvm is not in the path, similar to the following:

/usr/local/bin/node

To switch to a version managed by nvm:

nvm use 4

To verify you are using a version managed by nvm:

nvm which current

You should see something similar to the following:

/Users/<your-user-name>/.nvm/versions/node/v4.2.2/bin/node

You should only experience global install permission issues when you are using the system installation.