yarn: command not found

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

[root@localhost /]# yarn -version
bash: yarn: 未找到命令


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

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

[root@localhost /]# 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

[root@localhost bin]# export PATH=/usr/local/node-v10.15.0/bin/:$PATH
[root@localhost 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:

[root@localhost hzero-front]# yarn -version
1.13.0

转载自 https://blog.csdn.net/FTDD_HW/article/details/88819642

你可能感兴趣的:(工具使用)