mac 安装yarn 提示 common not found

npm i -g yarn //直接全局安装

 

然后执行

第一步:touch ~/.bash_profile //touch的意思是没有就创建;.bash_profile这是系统临时的环境变量, 
第二步:open -e ~/.bash_profile //打开这个文件,如果提示没有权限 请在前面加上 sudo

 

找到安装的yarn目录

还记得安装yarn的目录吗?如果忘记了再执行安装一边呗,如下图所示(图片为网上的非本人打码):

 

在发开的bash_profile文件中输入 export PATH=$PATH:/usr/local/node_global/bin

注意:请将 /usr/local/node_global 替换为你的 yarn 存在的目录

 

之后运行如下代码就可以了

source ~/.bash_profile
 
yarn --version

 仅作为个人记录

posted @ 2020-07-21 09:02  leo!  阅读(901)  评论(0编辑  收藏  举报