Img source:

I’m on Mac OS X and am using NVM installed via Homebrew. When I updated node with NPM, I started getting the error:

nvm is not compatible with the npm config "prefix" option

The Solution

I tried many things to fix this. Here is what worked:

$ mkdir ~/.nvm
$ brew update
$ brew uninstall nvm

Note that during the uninstall of nvm, I was warned that two other npm versions still existed. Homebrew showed me how to delete them. You should also delete them if you get the same warning:

brew uninstall --force nvm

Then reinstall nvm and a node version of your choice:

$ brew install nvm
$ brew install nvm 4.4.7 [or whatever version you want]

Also, I added the following two lines to ~/.bash_profile

export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/"

Start a new terminal window or bash shell, and BOOM: problem fixed.

Let me know if this works for you or if you have any problems or better solutions…