本文安装 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