Description
Description:
When using the "setup-node" action, CI non-deterministically fails, meaning that sometimes, I get no errors, and other times, I get errors.
Here is an example CI run where you can see the failures:
https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354
Specifically, the output is as follows:
Prepare all required actions
Getting action download info
Download action repository 'actions/setup-node@v4' (SHA:8f15[2](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:2)de45cc[3](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:3)93bb[4](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:4)8ce[5](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:5)d89d3[6](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:7)b731f54556e65)
Download action repository 'actions/cache@v3' (SHA:704facf57e6[13](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:15)6b1bc63b828d79edcd491f0ee84)
Run ./.github/workflows/setup
Run actions/setup-node@v4
Found in cache @ /opt/hostedtoolcache/node/20.9.0/x64
Environment details
/usr/local/bin/yarn --version
1.22.21
/usr/local/bin/yarn cache dir
error This project's package.json defines "packageManager": "yarn@4.0.2". However the current global version of Yarn is 1.22.21.
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and [14](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:16).[19](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:22).
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
Error: error This project's package.json defines "packageManager": "yarn@4.0.2". However the current global version of Yarn is 1.22.[21](https://github.com/IsaacScript/isaacscript/actions/runs/6907352290/job/18794331354#step:3:24).
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
Thus, we can see that this GitHub Action is failing to install Yarn properly, since Yarn appears to be version 1 instead of version 4.
For more context, we can see that this repository has a GitHub Actions matrix set up where it spawns N jobs and all of the jobs use "setup-node". Thus, since there are some green checkmarks and some red checkmarks, we can see that it fails randomly, and the specific checkmarks that appear are randomized with every commit to the repository.
Action version:
4
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
yarn v4.0.2
More info:
I started seeing this error today, with no other related CI code changes, so the problem is likely to come from this action (or the GitHub Action VM) and not my actual code-base.