问题
brew install yarn --without-node
不再起作用,yarn 已经删除了 option --without-node
。
准备
homebrew 已安装。
(非必需条件)使用 zsh 替换 bash:
chsh -s /bin/zsh
安装步骤
安装 nvm:
- 确定
~/.bash_profile
是否存在,如果没有则新建一个;执行touch ~/.bash_profile
; 执行安装命令:
// cURL:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash// or Wget:wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
安装 node:
// 安装最新 nodenvm install node --latest-npm// Always default to the latest available node version on a shellnvm alias default node
检查 node:
node -v
显示 node 版本,例如
v12.1.0
- 确定
安装 yarn:
安装 yarn 时不安装 node:
brew install yarn --ignore-dependencies
查找 node:
which node
显示 node 的安装位置,例如:
/Users/<your's-user-name>/.nvm/versions/node/v12.1.0/bin/node
执行
brew doctor
检查依赖,会出现:Warning: Some installed formulae are missing dependencies.You should `brew install` the missing dependencies: brew install nodeRun `brew missing` for more details.
为 homebrew 创建 node 的 symbol link:
ln -s ~/.nvm/versions/ /usr/local/Cellar/node
- 再次执行
brew doctor
进行检查,Warning 信息消失。