本文安裝 node@14
版本,官方的長期支持版本(LTS)
https://nodejs.org/
查找node
版本
brew search node
正常安裝
自動下載最新版本 node
brew install node
安裝指定版本
brew install node@14
設置全局變量
根據安裝完成後的提示
node@14 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have node@14 first in your PATH run:
echo 'export PATH="/usr/local/opt/node@14/bin:$PATH"' >> ~/.zshrc
For compilers to find node@14 you may need to set:
export LDFLAGS="-L/usr/local/opt/node@14/lib"
export CPPFLAGS="-I/usr/local/opt/node@14/include"
注意去除
'
單引號
設置
export PATH="/usr/local/opt/node@14/bin:$PATH" >> ~/.zshrc
檢查
~ node -v
v14.15.1