4

We have a Yarn-based monorepo with the latest Yarn version 3.2.0. We are getting yarn install failures with zero debug logs on our GitHub Workflow:

Run yarn install
➤ YN0000: ┌ Resolution step
Resolution step
➤ YN0000: └ Completed in 1s

➤ YN0000: ┌ Post-resolution validation
Post-resolution validation
➤ YN0000: └ Completed in 0s 226ms
➤ YN0000: Failed with errors in 1s 236ms

This happens when most of our team generates the yarn.lock file, except one team member is able to generate a working yarn.lock that works in the Workflow. The strange part is he is running a very similar setup to most other devs (MBP, Node 16).

Any idea what could be causing this and how we can find out more information?

rhlsthrm
  • 769
  • 1
  • 12
  • 23
  • 2
    Add `--verbose` to the command so you get better logging out of yarn. Right now this could be almost anything. – Karl-Johan Sjögren May 18 '22 at 06:18
  • @Karl-JohanSjögren Run yarn install --verbose 4 Unknown Syntax Error: Unsupported option name ("--verbose"). 5 6 $ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0] 7 Error: Process completed with exit code 1. – rhlsthrm May 19 '22 at 07:22
  • Hm, seems they removed the verbose flag that was available in "classic" Yarn. There should be some kind of setting to get more logging though, you'll have to check the documentation for it. – Karl-Johan Sjögren May 19 '22 at 07:48
  • Running into this as well. @rhlsthrm were you able to find a solution? – buildc0de May 28 '22 at 00:06
  • Oh! Just found your commit here: https://github.com/connext/nxtp/commit/3b06c9bfc75946f7a79b03b7dc24bb135ce64122. Looks like checksumBehavior: "update" does the trick?! I will add the answer. – buildc0de May 28 '22 at 00:38

2 Answers2

6

By default, Yarn will throw an exception on yarn install if it detects that a package doesn't match the checksum stored within the lockfile. To fix:

  1. Open your .yarnrc.yml.
  2. Add the following configuration option:

checksumBehavior: "update"

buildc0de
  • 193
  • 5
2

To resolve this issue, upgrade Yarn to version 3.2.4 or later.

Background:

There were a couple of issues in older versions of Yarn 3 that caused the checksum check to fail — upgrading will resolve this issue.

Josh Buchea
  • 1,366
  • 14
  • 14
  • How do you determine which version of yarn is being used in github actions? The documentation is unclear – Caleb Jay Apr 26 '23 at 03:20
  • Modern yarn will use whatever version is in your `.yarn` directory. It should also be explicitly stated in `package.json` under `packageManager` – Michael Liu May 04 '23 at 21:43
  • To install a specific version of yarn: `yarn set version `; e.g., `yarn set version 3.2.4` or `yarn set version stable`, `yarn set version latest` – Datow King May 29 '23 at 18:08