代码之家  ›  专栏  ›  技术社区  ›  Francesco Borzi

纱线错误:没有场景;必须至少有一个

  •  2
  • Francesco Borzi  · 技术社区  · 7 年前

    我试图安装 Yarn 当我使用 yarn 我得到的命令:

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

    我的 yarn --version 0.32 . 为什么不起作用?

    1 回复  |  直到 7 年前
        1
  •  251
  •   digitalextremist    4 年前

    看起来我试着执行了错误的任务,因为仅仅是运行 sudo apt install yarn 在我的Ubuntu 18.04上给了我 yarn from cmdtest

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

    sudo apt remove yarn
    

    official website explains ,在我的例子(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
    
        2
  •  87
  •   Peoray    6 年前

    你猜错了。你正在表演的故事来自 cmdtest 包裹首先卸载cmdtest可以解决以下问题:

    sudo apt remove cmdtest

    卸载后,运行以下命令以正确安装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
    
        3
  •  17
  •   Saeed    5 年前

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

    sudo apt install yarnpkg
    

    这就是解决方案。

        4
  •  15
  •   Mario Petrovic Emmanuel Onah    5 年前

    一步一步地尝试。这对我很有效。

    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
    
        5
  •  8
  •   Muhammed ASLAN    4 年前
    sudo npm install -g yarn
    

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

        6
  •  3
  •   Pavel Fedotov    4 年前

    升级到nodejs后,我开始收到这个错误。 修复这些错误的步骤是:

    1. sudo apt remove cmdtest
    2. sudo apt autoremove
    3. sudo npm install -g yarn
        7
  •  1
  •   cursorrux Erfan Ahmadi    4 年前

    看起来你试着执行了错误的任务,因为仅仅是运行 sudo apt install yarn 在您的 Ubuntu 18.04 cmdtest .

    为了解决这个问题,你应该从官方网站安装纱线 https://yarnpkg.com/getting-started/install . 我建议在上述网站上阅读更多关于纱线的信息

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

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

      输出如下所示:

      OK
      
    2. 要知道是否传输了数据,可以使用 回响 命令(它是linux内置命令)

      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
    
        8
  •  0
  •   qidizi    4 年前

    这是名字 “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;
        });
      }
    }
    
    
    
        9
  •  -2
  •   Ruan Nawe    7 年前

    sudo apt安装--无安装建议