我正在尝试在我的计算机上安装 metronic,为此我需要安装 yarn。所以我运行了命令:
npm install --global yarn /Users/cbarrial/.npm-global/bin/yarn -> /Users/cbarrial/.npm-global/lib/node_modules/yarn/bin/yarn.js /Users/cbarrial/.npm-global/bin/yarnpkg -> /Users/cbarrial/.npm-global/lib/node_modules/yarn/bin/yarn.js + yarn@1.16.0 updated 1 package in 0.376s
所以我想安装工作正常,但是如果我尝试使用 yarn 命令,我会得到这个:
yarn --version -bash: yarn: command not found
我不知道问题出在哪里,我已经安装了最新的 npm 和 node.js 并且工作正常。
最佳答案
您可以安装 yarn 在接下来的方式:
sudo apt-get install curl # Only if you don't have installed curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
这种方式是在 debian/ubuntu 上安装 yarn 的替代方法,但您可以在 official page for Yarn 中找到适用于不同操作系统的替代安装。在 部分替代品
关于bash - "Yarn: command not found"即使安装后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56687755/