I recently got the following error when loading a new tmux session:
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local" Run `npm config delete prefix` or `nvm use --delete-prefix v8.12.0 --silent` to unset it.
NVM failed to load in the tmux session, but did work correctly outside of tmux. Running
npm config delete prefix did not work.
Apparently on this machine I had previously installed node/npm from Homebrew before switching to NVM. When uninstalling the Homebrew version to install NVM, Homebrew failed to remove the packages completely.
usr/local/bin still contained links to the previously installed npm.
The solution is to remove the links and the linked directory. Tmux will then load NVM correctly.
rm /usr/local/bin/npm rm /usr/local/bin/npx rm -rf /usr/local/lib/node_modules