If you are experiencing this problem and see an answer like this: Node version management tool n is not working and the solution is still not working, try changing the environment variable file

vim ~/.zshrc
Copy the code

SHIFT + G to the end of the file:

#export PATH="$PATH:/usr/local/opt/node@8/bin
export PATH="/usr/local/bin:$PATH" # Add this line
Copy the code

:wq Save the changes and exit

Run source to effect the configuration

source ~/.zshrc
Copy the code

Then execute n to switch the node version, and find that OK, that’s how I solved it. If you have other closing Windows on the command line and the node version is not synchronized in one of them, close and open again.