Web Devolution

nvm Prefix Issue

November 25, 2018

Strange thing happened yesterday as I opened up a new terminal in Visual Studio Code, printed just above the usual bash input was the error:

nvm is not compatible with the npm config "prefix" option: currently set to "/home/linuxbrew/.linuxbrew" Run npm config delete prefix or nvm use --delete-prefix v11.2.0 --silent to unset it

I immediately took to searching for a solution. What I found was this comment in an issue thread documented on nvm’s GitHub repo.

nvm Prefix Issue Solution

After running the suggested:

npm config delete prefix

The key was to overwrite the nvm prefix with the command:

npm config set prefix $NVM_DIR/versions/node/v<version>

And replacing <version> with the version of Node.js listed in the error (in this case, v11.2.0). The error message then went away.

Matthew Conrad

Written by Matthew Conrad, a web developer in Seattle. You can follow me on Twitter and GitHub.