-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node setup fails non-deterministically with Yarn starting on November 17th #899
Comments
Also seeing this issue. This seems to be due to some runners are using yarn 1.22.19 and others 1.22.21. The yarn release 1.22.20 notes state that a message saying that Corepack should be installed, but it appears to be erroring. |
I was stuck with the same problem. yarn set version latest --yarn-path |
Can confirm @kurone-kito solution works as a workaround for this 🎉 |
Committing the Yarn binary to the repo is a good workaround for now, thanks. However, note that doing this is discouraged in Yarn version 4, as the ecosystem should use corepack going forward. So I would love a solution to this |
I was able to work around this by enabling corepack before running setup-node at least |
How do you enable corepack before installing node, since corepack is part of node? |
I believe the action runner image contains a copy of node, as most actions are themselves written in JavaScript (including this one I think?) |
Thank you for creating pull request! We'll make sure to look into it and come back with the details. |
I have added yarn binaries to the repo too while a solution is found. Thanks! |
|
@will-path this worked for me, thanks 💜 |
As @Mause mentioned, this can be temporarily solved by enabling Corepack before running jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ - name: Enable Corepack before setting up Node
+ run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm test |
@felladrin Yea, that's better and actually caches my Yarn deps. Setting |
See actions/setup-node#899 When defining `packageManager` in package.json, github runners will now error about using the wrong yarn version. This change seems like it'll be a temp fix until either the setup-node action or github runner gets update (to what exactly, I'm not sure, but we should follow the issue).
As mentioned by @felladrin, enabling corepack before the setup-node action certainly works on Ubuntu. But not on Windows, it seems. Run actions/setup-node@v4
with:
cache: yarn
node-version: 18.x
always-auth: false
check-latest: false
token: ***
Found in cache @ C:\hostedtoolcache\windows\node\18.18.2\x64
Environment details
node: v18.18.2
npm: 9.8.1
yarn: 1.22.21
C:\Windows\system32\cmd.exe /D /S /C "C:\npm\prefix\yarn.cmd --version"
1.22.21
C:\Windows\system32\cmd.exe /D /S /C "C:\npm\prefix\yarn.cmd cache dir"
error This project's package.json defines "packageManager": "[email protected]". 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.19.
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": "[email protected]". 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.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack. On the other hand, as @tomdickman mentioned, using the setup-node action without the cache option solves the Windows problem. What is the difference between these? |
Hello @Zamiell , Thank you for creating the issue and providing us with details! |
Hello @Zamiell , just a gentle ping! |
Why are you pinging me? |
Hey @Zamiell , as per my previous comment, we will consider this issue as an enhancement in future. |
If you have investigated the issue, can you explain why the error only happens sometimes, and not other times? Naively, I would expect that to indicate some kind of bug in either this GitHub action or the GitHub runner virtual machine. Furthermore, Yarn 4 was released on October 22nd, 2023, and this GitHub Actions issue started occurring on November 17th, 2023. Which means that Yarn 4 worked just fine with this action for 26 days. Thus, I find your classification of the race condition described in the OP as a "feature request" rather than an "bug" completely baffling. Can you explain further why it is a "feature request" to request that something that already worked continues to work in the same way? |
…node#899 Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]> Set dry run to test the github flow Signed-off-by: cmoulliard <[email protected]> Specify the packagemanager to be used Signed-off-by: cmoulliard <[email protected]> Enable corepack as it is needed to use packageManager yarn > 1.x Signed-off-by: cmoulliard <[email protected]> Moving corepack enable before calling setup-node. See: actions/setup-node#899 Signed-off-by: cmoulliard <[email protected]> Removing the hack folder as non needed anymore. Creating an empty yarn.lock file to avoid error: Dependencies lock file is not found Signed-off-by: cmoulliard <[email protected]> Fix indentation issue Signed-off-by: cmoulliard <[email protected]> Remove the deprecated parameter to use --immutable Signed-off-by: cmoulliard <[email protected]> Removing the yarn install strep as it raises a yarn YN0028 error with lockfile Signed-off-by: cmoulliard <[email protected]> Trying again to install the packages before to tsc compile Signed-off-by: cmoulliard <[email protected]> Fix proposed by plone/volto-addon-ci#11 concerning lockfile issue Signed-off-by: cmoulliard <[email protected]> Deleting --immutable to try to fix issue of yarn YN0028 Signed-off-by: cmoulliard <[email protected]> Using --no-immutable Signed-off-by: cmoulliard <[email protected]> Adding needed dependency as tsc fails with: TS2688: Cannot find type definition file for 'jest, node' Signed-off-by: cmoulliard <[email protected]> intall jest Signed-off-by: cmoulliard <[email protected]> Run foreach to install missing node modules Signed-off-by: cmoulliard <[email protected]> Let's use the backstage action instead ;-) Signed-off-by: cmoulliard <[email protected]> Pusing yarn.lock Signed-off-by: cmoulliard <[email protected]> Using same packageManager version as backstage Signed-off-by: cmoulliard <[email protected]> Use same action defintion as backstage Signed-off-by: cmoulliard <[email protected]> Updating yarn.lock file Signed-off-by: cmoulliard <[email protected]> Removing spaces Signed-off-by: cmoulliard <[email protected]> Adding .nmprc file Signed-off-by: cmoulliard <[email protected]> Enabling again corepack as we will use yarn package manager > 1.x Signed-off-by: cmoulliard <[email protected]> Let's try a build using node 18.x as 20.x fails on ci platform Signed-off-by: cmoulliard <[email protected]> Switch from tsc:full to tsc Signed-off-by: cmoulliard <[email protected]> adding to tsc --skipLibCheck false --incremental false Signed-off-by: cmoulliard <[email protected]> adding to tsc --skipLibCheck false --incremental false Signed-off-by: cmoulliard <[email protected]> Use workspaces foreach tsc Signed-off-by: cmoulliard <[email protected]> Removing tsc:full as it do not exist Signed-off-by: cmoulliard <[email protected]> Install the command supporting foreach subcommand Signed-off-by: cmoulliard <[email protected]> List the plugin installed Signed-off-by: cmoulliard <[email protected]> List the plugin installed Signed-off-by: cmoulliard <[email protected]> Checking what we have as executable under node_modules/.bin Signed-off-by: cmoulliard <[email protected]> Removing trailing , Signed-off-by: cmoulliard <[email protected]> Refactor the workflow to use the action of janus-idp project Signed-off-by: cmoulliard <[email protected]> Push the missing .nvmrc file Signed-off-by: cmoulliard <[email protected]> Removing packageManager > 1.x Signed-off-by: cmoulliard <[email protected]> Removing yarn.lock Signed-off-by: cmoulliard <[email protected]> Set cache-dependency-path Signed-off-by: cmoulliard <[email protected]> Generating the package-lock.json Signed-off-by: cmoulliard <[email protected]> Split tsc and build steps Signed-off-by: cmoulliard <[email protected]> Removing unknow parameter Signed-off-by: cmoulliard <[email protected]> Removing unknow parameter Signed-off-by: cmoulliard <[email protected]> Use turbo commands Signed-off-by: cmoulliard <[email protected]> Add turbo.json config file Signed-off-by: cmoulliard <[email protected]> Define the needed config files able to find the generated .d.ts Signed-off-by: cmoulliard <[email protected]> Let's try using turbo ... Signed-off-by: cmoulliard <[email protected]> Remove cache parameter Signed-off-by: cmoulliard <[email protected]> Adding needed yarn.lock Signed-off-by: cmoulliard <[email protected]> Check files generated Signed-off-by: cmoulliard <[email protected]> Adding missing shell parameter Signed-off-by: cmoulliard <[email protected]> Removing non accessible folder Signed-off-by: cmoulliard <[email protected]> Moving step to ci.yaml file Signed-off-by: cmoulliard <[email protected]> Add comments and test using node 20.x too Signed-off-by: cmoulliard <[email protected]> Published the modules manually and updated project Signed-off-by: cmoulliard <[email protected]> Fix wrong file to be used to publish: dist/index.cjs.js to dist/index.esm.js for the frontend Signed-off-by: cmoulliard <[email protected]> Bump versions published Signed-off-by: cmoulliard <[email protected]> Remove non needed dependency as we dont use yarn workspaces foreach Signed-off-by: cmoulliard <[email protected]> Align with latest versions published Signed-off-by: cmoulliard <[email protected]> Removing non needed file Signed-off-by: cmoulliard <[email protected]> Removing non needed file Signed-off-by: cmoulliard <[email protected]> Adding the needed scripts used to switch from src files to dist files when we pack or publish otherwise the package.json published will point to the src files and not the compiled ! Signed-off-by: cmoulliard <[email protected]> Ignore this file package.json-prepack Signed-off-by: cmoulliard <[email protected]> Passing the version of node to be used using an input parameter to the action Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]> Set dry run to test the github flow Signed-off-by: cmoulliard <[email protected]> Specify the packagemanager to be used Signed-off-by: cmoulliard <[email protected]> Enable corepack as it is needed to use packageManager yarn > 1.x Signed-off-by: cmoulliard <[email protected]> Moving corepack enable before calling setup-node. See: actions/setup-node#899 Signed-off-by: cmoulliard <[email protected]> Removing the hack folder as non needed anymore. Creating an empty yarn.lock file to avoid error: Dependencies lock file is not found Signed-off-by: cmoulliard <[email protected]> Fix indentation issue Signed-off-by: cmoulliard <[email protected]> Remove the deprecated parameter to use --immutable Signed-off-by: cmoulliard <[email protected]> Removing the yarn install strep as it raises a yarn YN0028 error with lockfile Signed-off-by: cmoulliard <[email protected]> Trying again to install the packages before to tsc compile Signed-off-by: cmoulliard <[email protected]> Fix proposed by plone/volto-addon-ci#11 concerning lockfile issue Signed-off-by: cmoulliard <[email protected]> Deleting --immutable to try to fix issue of yarn YN0028 Signed-off-by: cmoulliard <[email protected]> Using --no-immutable Signed-off-by: cmoulliard <[email protected]> Adding needed dependency as tsc fails with: TS2688: Cannot find type definition file for 'jest, node' Signed-off-by: cmoulliard <[email protected]> intall jest Signed-off-by: cmoulliard <[email protected]> Run foreach to install missing node modules Signed-off-by: cmoulliard <[email protected]> Let's use the backstage action instead ;-) Signed-off-by: cmoulliard <[email protected]> Pusing yarn.lock Signed-off-by: cmoulliard <[email protected]> Using same packageManager version as backstage Signed-off-by: cmoulliard <[email protected]> Use same action defintion as backstage Signed-off-by: cmoulliard <[email protected]> Updating yarn.lock file Signed-off-by: cmoulliard <[email protected]> Removing spaces Signed-off-by: cmoulliard <[email protected]> Adding .nmprc file Signed-off-by: cmoulliard <[email protected]> Enabling again corepack as we will use yarn package manager > 1.x Signed-off-by: cmoulliard <[email protected]> Let's try a build using node 18.x as 20.x fails on ci platform Signed-off-by: cmoulliard <[email protected]> Switch from tsc:full to tsc Signed-off-by: cmoulliard <[email protected]> adding to tsc --skipLibCheck false --incremental false Signed-off-by: cmoulliard <[email protected]> adding to tsc --skipLibCheck false --incremental false Signed-off-by: cmoulliard <[email protected]> Use workspaces foreach tsc Signed-off-by: cmoulliard <[email protected]> Removing tsc:full as it do not exist Signed-off-by: cmoulliard <[email protected]> Install the command supporting foreach subcommand Signed-off-by: cmoulliard <[email protected]> List the plugin installed Signed-off-by: cmoulliard <[email protected]> List the plugin installed Signed-off-by: cmoulliard <[email protected]> Checking what we have as executable under node_modules/.bin Signed-off-by: cmoulliard <[email protected]> Removing trailing , Signed-off-by: cmoulliard <[email protected]> Refactor the workflow to use the action of janus-idp project Signed-off-by: cmoulliard <[email protected]> Push the missing .nvmrc file Signed-off-by: cmoulliard <[email protected]> Removing packageManager > 1.x Signed-off-by: cmoulliard <[email protected]> Removing yarn.lock Signed-off-by: cmoulliard <[email protected]> Set cache-dependency-path Signed-off-by: cmoulliard <[email protected]> Generating the package-lock.json Signed-off-by: cmoulliard <[email protected]> Split tsc and build steps Signed-off-by: cmoulliard <[email protected]> Removing unknow parameter Signed-off-by: cmoulliard <[email protected]> Removing unknow parameter Signed-off-by: cmoulliard <[email protected]> Use turbo commands Signed-off-by: cmoulliard <[email protected]> Add turbo.json config file Signed-off-by: cmoulliard <[email protected]> Define the needed config files able to find the generated .d.ts Signed-off-by: cmoulliard <[email protected]> Let's try using turbo ... Signed-off-by: cmoulliard <[email protected]> Remove cache parameter Signed-off-by: cmoulliard <[email protected]> Adding needed yarn.lock Signed-off-by: cmoulliard <[email protected]> Check files generated Signed-off-by: cmoulliard <[email protected]> Adding missing shell parameter Signed-off-by: cmoulliard <[email protected]> Removing non accessible folder Signed-off-by: cmoulliard <[email protected]> Moving step to ci.yaml file Signed-off-by: cmoulliard <[email protected]> Add comments and test using node 20.x too Signed-off-by: cmoulliard <[email protected]> Published the modules manually and updated project Signed-off-by: cmoulliard <[email protected]> Fix wrong file to be used to publish: dist/index.cjs.js to dist/index.esm.js for the frontend Signed-off-by: cmoulliard <[email protected]> Bump versions published Signed-off-by: cmoulliard <[email protected]> Remove non needed dependency as we dont use yarn workspaces foreach Signed-off-by: cmoulliard <[email protected]> Align with latest versions published Signed-off-by: cmoulliard <[email protected]> Removing non needed file Signed-off-by: cmoulliard <[email protected]> Removing non needed file Signed-off-by: cmoulliard <[email protected]> Adding the needed scripts used to switch from src files to dist files when we pack or publish otherwise the package.json published will point to the src files and not the compiled ! Signed-off-by: cmoulliard <[email protected]> Ignore this file package.json-prepack Signed-off-by: cmoulliard <[email protected]> Passing the version of node to be used using an input parameter to the action Signed-off-by: cmoulliard <[email protected]>
Hello @Zamiell , |
Signed-off-by: cmoulliard <[email protected]>
* WIP. Refactor the backend to use the new backend system. #88 Signed-off-by: cmoulliard <[email protected]> * The following property "private" has been remeoved by yarn 4.x. from phe plugins package.json Signed-off-by: cmoulliard <[email protected]> * Fix issue reported within #88 such as violation error. Switch to a more recent version of yarn, add signin page which is needed to use guest auth provider Signed-off-by: cmoulliard <[email protected]> * Enable corepack to allow to use yarn >= 1.x Signed-off-by: cmoulliard <[email protected]> * Enable corepack to allow to use yarn >= 1.x within build-k8s-image job too Signed-off-by: cmoulliard <[email protected]> * Use the command corepack enable before to install the packages Signed-off-by: cmoulliard <[email protected]> * Move corepack enable task to the correct place Signed-off-by: cmoulliard <[email protected]> * Use corepack prepare yarn@stable --activate to set the proper package manager as we still got job errors Signed-off-by: cmoulliard <[email protected]> * Try to use the hack documented here: actions/setup-node#899 Signed-off-by: cmoulliard <[email protected]> * Add missing yarn.lock file Signed-off-by: cmoulliard <[email protected]> * Use --immutable-cache as --prefer-offline --frozen-lockfile are deprecated Signed-off-by: cmoulliard <[email protected]> * Replace --immutable-cache with --immutable Signed-off-by: cmoulliard <[email protected]> --------- Signed-off-by: cmoulliard <[email protected]>
Downgrade to [email protected] work for me, |
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:
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:
Runner type:
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.
The text was updated successfully, but these errors were encountered: