外观
I use Mac. I installed node, and then one day I use nvm. Everything is well when I am using IntelliJ IDEA. But when I use VS Code, I will see the following tips in terminal panel. And I need to execute command `nvm use v16.14.2` to toggle to the expected node version.
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local" Run
npm config delete prefixornvm use --delete-prefix v9.2.1to unset it.
1. Delete npm prefix
npm config delete prefix
npm config set prefix $NVM_DIR/current2. Delete node, node_modules, globally installed packages (not installed by nvm)
sudo rm -rf /usr/local/lib/node_modules
sudo rm /usr/local/bin/node
cd /usr/local/bin && ls -l | grep "../lib/node_modules/" | awk '{print $9}'| xargs rm3. Set nvm
nvm alias default v16.14.2
nvm use v16.14.24. Validate Close the current terminal panel and open a new one, then execute the follow command:
node -vIf the output is `v16.14.2`, then we succeed.