欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

yarn: command not found

程序员文章站 2022-05-29 09:09:14
...

今天在bash中使用npm(6.9.0)安装 yarn 。安装是成功了,但无法使用yarn 命令,提示如下:

[[email protected] /]# yarn -version
bash: yarn: 未找到命令

百度、谷歌后折腾了一番才解决,其实很简单,不过查到了方法但全英文不好理解,这里记一下

安装yarn 后如下,记住yarn 路径并添加到 $PATH

[[email protected] /]# npm install -g yarn
npm WARN rm not removing /usr/local/node-v10.15.0/bin/yarn as it wasn't installed by /usr/local/node-v10.15.0/lib/node_modules/yarn
/usr/local/node-v10.15.0/bin/yarn -> /usr/local/node-v10.15.0/lib/node_modules/yarn/bin/yarn.js
+ [email protected]
updated 1 package in 2.874s

[[email protected] bin]# export PATH=/usr/local/node-v10.15.0/bin/:$PATH
[[email protected] bin]# echo $PATH
/usr/local/node-v10.15.0/bin/:/root/.yarn/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/hzero/.local/bin:/home/hzero/bin:

[[email protected] hzero-front]# yarn -version
1.13.0