程序员の奇妙冒险

返回
安装软件 MacOS
2025-04-08 14:51 阅读:192 评论:0

brew安装node

以安装node14为例 breww 安装node 使用 n 切换版本无效,去官网下载pkg 安装包没有这个问题 安装brew install node\@14 卸载brew uninstall node\@14 当执行brew install node\@14命令。下载安装完成后会提升如下 意思是想

以安装node14为例

breww 安装node 使用 n 切换版本无效,去官网下载pkg 安装包没有这个问题

  • 安装brew install node@14
  • 卸载brew uninstall node@14
  • 当执行brew install node@14命令。下载安装完成后会提升如下
1
2
3
4
5
6
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"
  • 意思是想让你配置node的环境变量,不然node的命令无法使用

整理后的命令

1
2
3
4
$ echo 'export PATH="/usr/local/opt/node@14/bin:$PATH"' >> ~/.zshrc
$ echo 'export LDFLAGS="-L/usr/local/opt/node@14/lib"' >> ~/.zshrc
$ echo 'export CPPFLAGS="-I/usr/local/opt/node@14/include"' >> ~/.zshrc
$ source ~/.zshrc

node 安装 yarn

npm install yarn@latest -g

设置数据源

1
2
3
npmyarn NPM
npm config set registry https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org
评论 (0)
暂无评论 来抢沙发吧~