Nodejs的项目经常Node自身的版本不同而无法运行,如果每次都选择卸载掉一个版本的Nodejs再安装另外一个版本的Nodejs,会很费劲,通过如下命令切换。
例如:
# For example # Install main node version 18 $ brew install node@18 # Add the main version to ~/.zshrc to make started # (~/.bash_profile if you're using default shell) $ echo 'export PATH="/usr/local/opt/node@18/bin:$PATH"' >> ~/.zshrc # Execute updated $ source ~/.zshrc # Check version of installed node $ node -v v18.12.1 ### Want to witch to node version 14 $ brew install node@14 # Check version of installed node $ node -v v14.17.2 # Unlink main node version 18 $ brew unlink node # Link node version 14 $ brew link node@14
参照:https://medium.com/@fucyber/manage-multiple-node-versions-with-homebrew-and-nvm-2c72d98a9f5a
标签:node,OSX,14,Nodejs,18,version,切换,brew From: https://www.cnblogs.com/WestContinent/p/18182869