纱线错误: 没有情况; 必须至少有一个

我尝试安装 纱线,当我使用 yarn命令时,我得到:

00h00m00s 0/0: : ERROR: There are no scenarios; must have at least one.

我的 yarn --version0.32。为什么它不工作?

86230 次浏览

看起来我试图执行错误的纱线,因为仅仅在我的 Ubuntu 18.04上运行 sudo apt install yarn就给了我 测试用纱线

所以我通过卸载解决了这个问题:

sudo apt remove yarn

通过安装它作为 官方网站解释,在我的情况下(Ubuntu 18.04)它是如下:

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

Sudo apt install ——无安装推荐纱线

您得到了错误的纱线。您正在执行的纱线来自 cmdtest包。首先卸载 cmdtest 应该可以解决这个问题:

sudo apt remove cmdtest

Once you've uninstalled it, run the commands below to install yarn properly:

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

安装时应该使用的真实名称是 yarnpkg

sudo apt install yarnpkg

That is the solution.

一步一步来,这招对我很管用。

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

升级到 nodejs 后,我开始收到这个错误。 The steps to fix those bugs were :

  1. sudo apt remove cmdtest
  2. sudo apt autoremove
  3. sudo npm install -g yarn
sudo npm install -g yarn

然后打开一个新的终端窗口,键入“纱——版本”

它的名字是 "yarnpkg",不是“纱线”


#which yarn
/usr/bin/yarn


# which yarnpkg
/usr/bin/yarnpkg


#yarn --version
0.32+git


# yarnpkg --version
1.22.10




# cat /usr/bin/yarn


#!/usr/bin/python3
# Copyright 2013  Lars Wirzenius
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# =*= License: GPL-3+ =*=




import cliapp
...








# cat /usr/bin/yarnpkg




#!/usr/bin/env node


/* eslint-disable no-var */
/* eslint-disable flowtype/require-valid-file-annotation */
'use strict';


var ver = process.versions.node;
var majorVer = parseInt(ver.split('.')[0], 10);


if (majorVer < 4) {
console.error('Node version ' + ver + ' is not supported, please use Node.js 4.0 or higher.');
process.exit(1); // eslint-disable-line no-process-exit
} else {
try {
require(__dirname + '/../lib/v8-compile-cache.js');
} catch (err) {
// We don't have/need this on legacy builds and dev builds
}


// Just requiring this package will trigger a yarn run since the
// `require.main === module` check inside `cli/index.js` will always
// be truthy when built with webpack :(
// `lib/cli` may be `lib/cli/index.js` or `lib/cli.js` depending on the build.
var cli = require(__dirname + '/../lib/cli');
if (!cli.autoRun) {
cli.default().catch(function(error) {
console.error(error.stack || error.message || error);
process.exitCode = 1;
});
}
}




看起来您试图执行错误的纱线,因为仅仅在 Ubuntu 18.04上运行 sudo apt install yarn就会从 cmdtest得到纱线。

To solve this problem you should install yarn from its official website 翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳翻译: 奇芳 https://yarnpkg.com/getting-started/install. I recommend to read more about yarn on above website

  1. 要传输数据,可以使用 curl

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    

    输出如下:

    OK
    
  2. To know either data was transferred or not , you can display that text/string by using Echo command( it is linux built-in command)

    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    

    产出情况如下:

    deb https://dl.yarnpkg.com/debian/ stable main
    
  3. 要从所有配置源下载包信息,请运行以下命令:

    sudo apt update && sudo apt install yarn
    
  4. 此阶段完成后检查纱线版型由

    yarn --version
    

    输出如下所示

    1.22.18
    

或者您可以按 npm 安装纱线

npm install -g yarn

建议使用 NPM安装纱线。 要做到这一点,请:

  • npm install --global yarn
  • yarn --version

了解更多

只是最新情况

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/yarnpkg.gpg
sudo apt update && sudo apt install yarn
yarn