Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

yarn on Ubuntu prints a scenarios error instead of running JavaScript tooling

ErrorERROR: There are no scenarios; must have at least one

Short answer

The yarn on your PATH is not the JavaScript package manager. On Debian and Ubuntu the cmdtest package ships a different tool called yarn, for scenario testing. Remove cmdtest, then install the real Yarn from its repository, or run it through Corepack or npm if cmdtest must stay.

  • Applies to Ubuntu 24.04, Debian 12, Node.js 22, Yarn 1.22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the system which package owns the yarn command that runs. A path in /usr/bin that belongs to cmdtest confirms the cause.

    which -a yarn
    dpkg -S "$(which yarn)"
  2. 2Match what you see, then jump to its fix

    1. 1dpkg -S names cmdtest, and yarn --version complains about scenariosThe cmdtest package put a different yarn on your PATHFix
    2. 2another tool depends on cmdtest, or removing it is not allowed on this machineYou need to keep cmdtest, so Yarn must come from somewhere elseFix

What does the error look like?

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

Cause 1 of 2

The cmdtest package put a different yarn on your PATH

1Check

The yarn from cmdtest is a scenario-testing tool for command-line programs. It wants a file with SCENARIO, GIVEN, WHEN and THEN blocks, so a bare yarn call finds none and stops.

dpkg -l cmdtest
man yarn | head -n 5

2Fix

The Yarn install guide tells you to remove cmdtest first when apt gives errors, then install Yarn from the Yarn package repository.

sudo apt remove cmdtest
sudo apt update && sudo apt install yarn

3Verify

yarn now reports a version number.

hash -r
yarn --version

Confirmed by classic.yarnpkg.com

Did this fix it?

Cause 2 of 2

You need to keep cmdtest, so Yarn must come from somewhere else

1Check

apt lists the packages it will remove and waits for your answer. Read that list and answer n if anything you need is on it.

sudo apt remove cmdtest

2Fix

Run Yarn through Corepack, which ships with Node.js before version 25 and puts yarn shims on your PATH, or install Classic Yarn with npm. Either way the first yarn found must be the new one, so check the order after installing.

corepack enable
# or, for Yarn 1 only
npm install --global yarn@1

3Verify

The first yarn in PATH is the one you installed.

which -a yarn
yarn --version

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Pin the package manager in package.json with the packageManager field so everyone gets the same Yarn.
  • In Dockerfiles and CI, install Yarn explicitly and print yarn --version early in the job.
  • Do not install test tools from the distribution without checking which commands they add.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

nginx gives up waiting for the app and returns 504

upstream timed out (110: Connection timed out) while reading response header from upstream

nginx returns 504 when the app behind it takes the request but sends nothing back within proxy_read_timeout (60 seconds by default), or when the connection cannot be opened in time.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.