zsh: command not found: yarn(从nodebrew重装node, yarn)

1.先把node,yarn都删干净

$ brew uninstall yarn
$ brew uninstall node
$ rm -rf /usr/local/lib/node_modules
$ brew cleanup
以防万一
$ brew doctor

2.因为再安装PATH变了,再读一次.bash_profile

$ source ~/.bash_profile 

3.安装nodebrew

从Homebrew 装 nodebrew 
$ brew install nodebrew
确定一下版本
$ nodebrew -v

4.把nodebrew的PATH写上去

从.bash_profile转移到.zprofile
$ cat .bash_profile >> .zprofile

.zprofile里面的PATH追加
$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zprofile

.zprofile再读一次
$ source ~/.zprofile

5.装Node.js

$ nodebrew install-binary stable

找不到路径就建一个

$ mkdir -p ~/.nodebrew/src
$ nodebrew install-binary stable

再确认一下

确认版本
$ nodebrew list

current: none没找到就指定一个
$ nodebrew use v12.14.0

确认一下Node.js版本
$ node -v

6.安装yarn

$ npm install -g yarn
$ yarn -v
正常显示了版本号就ok

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值