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

Created on 2 Mar 2017  ·  35Comments  ·  Source: yarnpkg/yarn

i want use "yarn " in my npm project
when run shell " yarn " in the shell,
it throw "ERROR: There are no scenarios; must have at least one. "

what problem?

yarn --version
0.27
node -v
v6.9.5
uname -a
Linux wfx-pc 4.4.0-3-deepin-amd64 #1 SMP Deepin 4.4.30-2 (2016-12-01) x86_64 GNU/Linux

Most helpful comment

You've got the wrong yarn 😄 The Yarn you're executing comes from the cmdtest package: http://manpages.ubuntu.com/manpages/xenial/man1/yarn.1.html. Uninstalling cmdtest should fix this. Once you've uninstalled it, follow the instructions on https://yarnpkg.com/en/docs/install#linux-tab to add the Yarn repo:

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

All 35 comments

@wangfaxi1985, please check again your yarn version, the latest version is 0.21.3 and the tagged version is 0.22.0-0.
Also check that you run yarn command in the folder where your package.jsonis located
Thanks

You've got the wrong yarn 😄 The Yarn you're executing comes from the cmdtest package: http://manpages.ubuntu.com/manpages/xenial/man1/yarn.1.html. Uninstalling cmdtest should fix this. Once you've uninstalled it, follow the instructions on https://yarnpkg.com/en/docs/install#linux-tab to add the Yarn repo:

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

cmdtest seems to be installed by default on Ubuntu 17.04 at least, so perhaps this should be added to the installation instructions...

For anyone that finds this, if you're getting an error on sudo apt-get install yarn run sudo apt remove cmdtest first.

On Ubuntu (at least 17.04), after you sudo apt remove cmdtest, first follow https://yarnpkg.com/en/docs/install#linux-tab > Ubuntu. Only then sudo apt-get install yarn. If you don't follow https://yarnpkg.com/en/docs/install#linux-tab, then running sudo apt-get install yarn will install cmdtest again.

On Ubuntu 17.10 I'm not able to install yarn - I removed cmdtest package, but sudo apt-get install yarn reinstall cmdtest.

@istals I have the same problem as you do. The cmdtest is still installed even if I remove it firstly. How do I get yarn on Ubuntu 17.10?

For Ubuntu 17.10, try the workaround:

sudo apt remove cmdtest
sudo apt install npm
sudo npm install -g yarn

For Ubuntu 17.10, you need to add the Yarn repo first.

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

Make sure you remove cmdtest if you have it installed.

Prefer this to installing via npm.

@jdorleans - you don't have to install npm if you're using Yarn :)

@jdorleans Thanks for your comment. I have successfully installed yarn by using npm install -g yarn.

Ubuntu: let's name binary of node package nodejs, but also let cmdtest binary be yarn

This would be much easier if instead of installing it as root, it was installed in user space.

@cserpell You can do that if you like. There's an install script you can use, or you could just download the Yarn tarball and extract it wherever you want. Details are on the site. Regardless, you're still going to have the issue of having multiple different multiple yarn binaries if you have cmdtest installed.

@sheerun To be fair, cmdtest used the yarn command first, before Yarn even existed.

@Daniel15 That's what I did, specially because I cannot install programs where I am working. The trick is just overriding any installed binary with my own bin directory.

I was having the same problem on Ubuntu 18.04 however I was able to fix using the following commands:

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

@Daniel15 I followed your instructions in previous comment and tried to reinstall yarn again.

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

after checking the version, i found the version to be 1.5.1
Is it ok? Or I did something wrong.
Also would it create any problem if I uninstall cmdtest and all its dependencies?

@Nazarah - That's correct, 1.5.1 is the latest stable version. If you want to get 1.6.0, you need to add the RC repo instead (replace "stable" with "rc" in /etc/apt/sources.list.d/yarn.list)

@Daniel15
unintalling cmdtest and dependency and installing yarn.txt

The 1st text file shows commad results from uninstalling cmdtest and all its dependencies till using your suggested commands to install yarn

installing yarn fresh.txt

this files shows when I tried to run yarn from home

I edited my comment because I realised that 1.5.1 is the latest version of Yarn :)

Thanks for your feedback. :D

@OmerHerera

Also check that you run yarn command in the folder where your package.jsonis located

Do you mean package.json for mastarm?

@becdetat I have Ubuntu 17.04 installed but when I type yarn --version after installing yarn as recommended, i got this as message « yarn » is not installed yet.You can install by typing : sudo apt install cmdtest . Then I run sudo apt install cmdtest but it failled.

@florianeBhz You need to add the Yarn repo first:

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

Then you can sudo apt-get update && sudo apt-get install yarn

More details on the Yarn site: https://yarnpkg.com/en/docs/install#debian-stable

For your Debian package, consider either conflicting with cmdtest in the debian/control; add a diversion in case the cmdtest executable already exists; use the update-alternatives pattern described here: https://wiki.debian.org/DebianAlternatives

; use the update-alternatives pattern described here: wiki.debian.org/DebianAlternatives

Alternatives are for when you have multiple different apps that do the same thing. It's not for dealing with naming conflicts.

Having said that, adding a conflict with cmdtest seems reasonable. We can do that!

As a side comment: Ubuntu devs seemed to consider that when the user types apt-get install foo, if foo doesn't exist but there's a command with that name provided by package bar, then it's a good idea to almost silently install package bar instead.

$ sudo apt-get install yarn
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'cmdtest' instead of 'yarn'
[...]
$ dpkg -S bin/yarn
cmdtest: /usr/bin/yarn

I personally think it's one of those cases when people think implementing a less strict behaviour will make people's life easier but really just complicates things because it introduces randomness (for example this issue).

Just use nvm to use npm to install yarn ...

sudo apt remove cmdtest
sudo apt remove yarn
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install node -lts
npm install -g yarn
yarn --version
1.12.3

You're welcome 🌮

@shawnolson-fp - people should not trust a random script to install NVM. Isn't there an official method that you can quote instead of spreading an insecure installation pattern? Thanks!

https://github.com/creationix/nvm is the official project on Github. It's literally who created it. I don't know of a safer way to do it. The alternative would be using PPA which would point to nodesource.com ... only two ways I know of.

@shawnolson-fp - that's not going to solve the problem listed in this
issue. The issue is that a different app that provides a "yarn" command
is installed. The only proper way of fixing that is by either uninstalling
the other app or removing it from your $PATH. You can change the order of
your $PATH instead, but having two apps that provide the same command can
be pretty confusing anyways.

Sent from my phone.

On Tue, Nov 13, 2018, 1:24 PM Benjamin Bach <[email protected] wrote:

@shawnolson-fp https://github.com/shawnolson-fp - people should not
trust a random script to install NVM. Isn't there an official method that
you can quote instead of spreading an insecure installation pattern? Thanks!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/2821#issuecomment-438442528, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAFnHe9xSSKcMf0WCOzezhob80rXrzeTks5uuzimgaJpZM4MQv_p
.

@shawnolson-fp - that's not going to solve the problem listed in this issue. The issue is that a different app that provides a "yarn" command is installed. The only proper way of fixing that is by either uninstalling the other app or removing it from your $PATH. You can change the order of your $PATH instead, but having two apps that provide the same command can be pretty confusing anyways. Sent from my phone.

On Tue, Nov 13, 2018, 1:24 PM Benjamin Bach @.* wrote: @shawnolson-fp https://github.com/shawnolson-fp - people should not trust a random script to install NVM. Isn't there an official method that you can quote instead of spreading an insecure installation pattern? Thanks! — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#2821 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFnHe9xSSKcMf0WCOzezhob80rXrzeTks5uuzimgaJpZM4MQv_p .

I understand the issue but like you said, the way around it is too much trouble for most people who just want yarn to work. Why on earth Debian decided to choose cmdtest instead of yarn is what the problem is. I am simply providing an alternative way to install yarn and npm in the same $PATH as nvm - A pretty slick package if you ask me ...

And until the issue is fixed, very few people will want to mess around with environment variables to solve something that seems so simple.

@shawnolson-fp haha, yes I noticed that curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash was actually the official installation instruction and deleted my comment. But I am shocked. SHOCKED!

Also, _Just use nvm to use npm to install yarn ......_ cruel cruel world. I hope everyone will think twice before doing this to get left-pad or whatever.

Btw. most Debian issues are solved revolving this. Except having an official package seems a bit out of reach still.

I would definitely not go with your pattern, it's overcomplicated.

Why on earth Debian decided to choose cmdtest instead of yarn is what the problem is.

Point the finger back at yarn. They were warned that this package name was taken before their public launch and have had inputs from Debian packaging people trying to solve this still. There is a current effort to create a package underway such that an official release can be in Debian and downstream dists such as Ubuntu.

@Daniel15 looking over this issue, it seems safe enough to close+freeze with a final note about reading the documentation? It seems keeping it open spins off undesirable workarounds?

References for ongoing Debian work:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843021
https://salsa.debian.org/js-team/node-yarnpkg

@benjaoming lol - that is something I didn't know, man what a mess!

I feel for both sides, because IMO Debian and Yarn are both the best at what they are, so I'm torn 😢
You'd think maybe a simple prompt at install: which yarn would you like to install @facebook/yarn or cmdtest/yarn?

At this point, most people will probably just say $# it and use npm. 😩

@facebook/yarn

Not related to the issue at hand, but Yarn is a community project, not a Facebook one - it would be @yarnpkg/yarn 🙂

@arcanis lol it was just an example 😋... so literal in here, ha!

looking over this issue, it seems safe enough to close+freeze with a final note about reading the documentation?

Good idea. I'm going to lock this as lots of unrelated (but valuable!) discussion is happening here. Feel free to create separate issues if there's anything left to discuss. In the meantime, please uninstall cmdtest if you want to use Yarn. The Yarn Debian package "conflicts" with cmdtest, so it should warn you about it.

Was this page helpful?
0 / 5 - 0 ratings