Thursday, January 25, 2018

VS Code and the Node Version Manager

nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local"

We can fix it! Jump to the end if you just want to know what to do, the middle explains why you need to do it.

This error was especially difficult to run down, which is why it warrants documenting it here. Ultimately it was a combination of how Node.js is installed, the Node Version Manager (nvm), a feature of the bash shell (3.6.2) in MacOS High Sierra, and that Visual Studio Code starts an integrated terminal with a login shell that triggered it. I have not explored any other Mac systems, and Linux systems could be affected as well. Similar behavior likely means the same problem is occurring.