137

I tried to install Yarn and when I used the yarn command I got:

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

my yarn --version is 0.32. Why doesn't it work?

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252

12 Answers12

323

It looks like that I was trying to execute the wrong yarn, because simply running sudo apt install yarn on my Ubuntu 18.04 gave me yarn from cmdtest.

So I solved by uninstalling it:

sudo apt remove yarn

And by installing it as the official website explains, which in my case (Ubuntu 18.04) it was the following:

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
digitalextremist
  • 5,952
  • 3
  • 43
  • 62
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
106

You've got the wrong yarn. The yarn you're executing comes from the cmdtest package. Uninstalling cmdtest first should fix this:

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
Peoray
  • 1,705
  • 2
  • 12
  • 21
  • 1
    I'm using Mint 20. I've tried other solutions, but only that one worked for me. Thanks! But I still got some errors while loading these commands: E: The repository 'http://apt.postgresql.org/pub/repos/apt ulyana-pgdg Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://download.docker.com/linux/ubuntu ulyana Release' does not have a Release file. – tibasce Dec 01 '20 at 12:16
  • 3
    This answer has the most relevant and easy-to-use code, for copying + pasting. Thx. – Marty McGee Dec 27 '20 at 20:43
  • 1
    this answer is most relevant for debian-based linux users who were "guided" by the terminal to install cmdtest instead of yarn. – beep_check Feb 16 '21 at 01:21
  • 2
    This answer has the correct set of commands. This worked for me . – Yashodha Samarawickrama May 17 '21 at 18:10
  • You are an angel! – Yuniac Jul 08 '23 at 12:07
26

The real name you should use when installing is yarnpkg

sudo apt install yarnpkg

That is the solution.

Saeed
  • 3,294
  • 5
  • 35
  • 52
Laynier Piedra
  • 425
  • 6
  • 16
16

Try this step by step. This worked for me.

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
Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
13
sudo npm install -g yarn

then open a new terminal window and type yarn --version

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Muhammed ASLAN
  • 151
  • 1
  • 5
8

It looks like that you was trying to execute the wrong yarn, because simply running sudo apt install yarn on your Ubuntu 18.04 gave you yarn from 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. To transfer data you can use from curl

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

    The output looks like this:

    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
    

    The output also looks like following:

    deb https://dl.yarnpkg.com/debian/ stable main
    
  3. To download package information from all configured sources run following:

    sudo apt update && sudo apt install yarn
    
  4. After this stage finished check yarn version by

    yarn --version
    

    The output looks like this

    1.22.18
    

Or you can install yarn by npm

npm install -g yarn
cursorrux
  • 1,382
  • 4
  • 9
  • 20
3

I began to receive this error after upgrade to nodejs. The steps to fix those bugs were :

  1. sudo apt remove cmdtest
  2. sudo apt autoremove
  3. sudo npm install -g yarn
Pavel Fedotov
  • 748
  • 1
  • 7
  • 29
2

Just an update

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
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 21 '22 at 06:20
1

it is name "yarnpkg" ,not "yarn"


#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;
    });
  }
}


qidizi
  • 331
  • 1
  • 3
  • 10
0

It is recommended to use NPM to install yarn. To achieve this, do:

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

learn more

Joshua Johns
  • 340
  • 1
  • 3
  • 10
0

step 1 -> sudo apt remove cmdtest

step 2 -> Download yarnpkg key curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - output - OK

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

step 4 -> Update and install yarn sudo apt update && sudo apt install yarn

step 5 -> Check yarn version yarn --version output - 1.22.19

-2

sudo apt install --no-install-recommends yarn

Ruan Nawe
  • 363
  • 6
  • 9