yarn 环境突然用不了

【报错】ERROR: There are no scenarios; must have at least one.

ERROR: There are no scenarios; must have at least one.

 上溯问题

The program 'npm' is currently not installed. To run 'npm' please ask your administrator to install the package 'npm'

 【问题原因】

npm环境版本过低,需要更新后使用

【解决办法】

卸载后重新安装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

安装后查看yarn版本

 显然还有问题,继续挖

【cli.js 报错】SyntaxError: Unexpected token {

/usr/share/yarn/lib/cli.js:46288
  let {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:24:13)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

【原因】

yarn版本与npm版本存在冲突

【解决办法】

固定版本安装nodejs

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
apt-get install -y nodejs

这里会有比较详细的信息,先试了10.x版本,可以成功。

最后按照下图的推荐使用了14.x,如果14.x不成功 可以使用其他版本 

按照以上方式,问题解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值