-bash:yarn:即使全局安装后也找不到命令 [英] -bash: yarn: command not found even after installing it globally

查看:149
本文介绍了-bash:yarn:即使全局安装后也找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mac OS 10.13.6

Mac OS 10.13.6

我如何安装纱线

npm install --global yarn

纱线安装路径为/Users/useName/.config/yarn

然后在命令下运行

yarn create react-app app-name

这很好用,但是当我尝试运行 yarn add package_name 时,它会抛出错误

This worked well, but when I'm trying to run yarn add package_name, it's throwing error

bash: yarn: command not found

奇怪的是,在再次关闭并打开终端之后,在该终端下我已全局(?)安装了纱线,却找不到纱线命令.

The weird thing, after closing and opening terminal again under which I had globally ( ? ) installed yarn, the yarn command is not found.

推荐答案

如果您使用的是 nodenv 并且 yarn 无法正常工作,请尝试简单的

If you are using nodenv and yarn is not working try a simple

$ nodenv哈希

那根纱线应该起作用

这篇关于-bash:yarn:即使全局安装后也找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆