Yarn install failing on GitHub Actions
Asked Answered
N

2

6

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?

Nuke answered 18/5, 2022 at 6:13 Comment(5)
Add --verbose to the command so you get better logging out of yarn. Right now this could be almost anything.Agonizing
@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.Nuke
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.Agonizing
Running into this as well. @Nuke were you able to find a solution?Kleon
Oh! Just found your commit here: github.com/connext/nxtp/commit/…. Looks like checksumBehavior: "update" does the trick?! I will add the answer.Kleon
K
7

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"

Kleon answered 28/5, 2022 at 0:42 Comment(2)
Can't we just use --frozen-lockfile instead to ignore the lock file entirely?Gabriellia
--frozen-lockfile is deprecated. Use --immutableAd
S
4

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.

Smolt answered 16/11, 2022 at 3:21 Comment(3)
How do you determine which version of yarn is being used in github actions? The documentation is unclearCompunction
Modern yarn will use whatever version is in your .yarn directory. It should also be explicitly stated in package.json under packageManagerCocainize
To install a specific version of yarn: yarn set version <version>; e.g., yarn set version 3.2.4 or yarn set version stable, yarn set version latestGargoyle

© 2022 - 2024 — McMap. All rights reserved.