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不成功 可以使用其他版本 

按照以上方式,问题解决

猜你喜欢

转载自blog.csdn.net/bulucc/article/details/127839842