返回归档

前端

yarn出现"There are no scenarios ; must have at least one"

问题

新部署好 Ubuntu 服务器,准备用 Yarn 安装依赖时出现:

There are no scenarios ; must have at least one

解决方法

先移除系统里容易冲突的 cmdtest 和旧的 yarn,再重新添加 Yarn 官方源安装。

sudo apt remove cmdtest
sudo apt remove yarn

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 update
sudo apt install yarn

备注

这个问题通常是因为 Ubuntu 仓库里的 cmdtest 占用了 yarn 命令,导致执行到的不是 Node.js 生态里的 Yarn。