You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to this issue and comment #182 (comment), I'd like to see support for enabling corepack without having to have a separate run step to do so.
Justification:
This would reduce overall runtime of actions, as no separate steps are required to enable corepack nor to install package managers, which is a net benefit to users in both regards.
Hi @shellscape,
Unfortunately, corepack is experimental now, so we would not implement that at least while its not become stable.
That is why I will close this issue now. If you have any questions or concerns, please feel free to leave a comment on this thread or open another issue.
Reacted by Vladimir Jimenez, Carson McManus, Karl O, Jon Goodger and Johan Nyman
Hm, I don't see anything codified in this repo that states experimental features aren't welcome. Seems that a experimental property would be a very good fit here. I think this was closed prematurely.
Hello @shellscape. I think the main reason to not enable corepack by default because some customers can use setup-node with cache enable in conjunction with pnpm/action-setup before setup-node. When corepack is enabled it will override preinstalled pnpm (from pnpm/action-setup).
For example users can specify use the latest version of pnpm (7th), but corepack can override it to 6th. This also applies to yarn.
Reacted by Arthur Brandstetter, elonzh, Oleksandr Danylchenko and Tomas Aprile
Is packageManager in your package.json set to pnpm@7.0.0?
No it does not. With packageManager it works as expected. But not all users have packageManager field, that is why it can break existing behaviour some users if corepack is enabled by default with caching.
Now for users who used a separate step to enable corepack, the github action is broken. Hence the declared goal of this change request is not met: "which is a net benefit to users in both regards".
error This project's package.json defines "packageManager": "yarn@3.3.1". 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](https://github.com/Found-ee/react-ui/actions/runs/6940271054/job/18878934903#step:3:21).
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@3.3.1". However the current global version of Yarn is 1.22.[21](https://github.com/Found-ee/react-ui/actions/runs/6940271054/job/18878934903#step:3:23).
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.
The step "Enable corepack" that follows is not executed, cause the action is already failed.
Reacted by Gonçalo Marantes, Chris Fraser, Amir Sharif, Mikael Finstad, Turadg Aleahmad, Vladislav Korenik and Seiya
Yeah I've noticed that as well. Initially it started happening randomly and re-triggering the CI fixed it, but now it happens consistently. The solution is to enable corepack before setup-node. I hope that one day setup-node will officially support corepack and such hacks won't be necessary anymore.
Reacted by Bernard Stojanović, Alex Sanders, Steven Crader, Suyan, Jonah Snider, Marius Butuc, Alfonso Irarrázaval and REL1CX
Reacted by Nate Hopkins, kooku-당근페이, Taylor Blanton, puz_zle, Alex Sanders, Jason Curtis, Morgän, Rodrigo Assis, jwhits, Max Grinberg and 35 more
Reacted by Max Grinberg, Alessandro Macagno, Mark Omarov, Praveen Kumar, Serhii Sydoruk, w3irdrobot, Philip Niedertscheider, Brendan F, MP3Martin and Michael Baudino
Reacted by Max Grinberg, Stephane SEGNING LAMBOU and MP3Martin
man, how come I have to find these things in a gh issue?
Is this officially documented anywhere?
I'm in the process of upgrading something to yarn 4 from 1 and couldn't find anything on github actions.
Reacted by Attila Večerek, Joe Donnelly, Adam Freidin, Rae Hill, Robert Kieffer, Gabriel Rohden, Sean Newell, Jacob Granberry, Josh Vermaire, lauraalkhoury-varicent and 50 more
Thanks, @dylants, for sharing your solution in #480 (comment). It did not work for me as-is, however did resolve the immediate problem, which helped me get to a final solution for my project.
I have a library, where all unit tests are run on a matrix of Windows and Linux, and then also for Node.js v16, v18, v20, and v22.
Dylan's solution worked for the following:
Linux
Windows
Node.js v16
❌
❌
Node.js v18
✅
❌
Node.js v20
✅
❌
Node.js v22
✅
❌
To fix runs on Linux with Node.js v16, I had to override the version of corepack to v0.20.0, the latest version available with Node.js v16 support, instead of using the one bundled with Node.js:
Activity
e-korolevskii commentedon May 4, 2022
Hi @shellscape,
We will investigate the possibility of adding this feature.
e-korolevskii commentedon May 4, 2022
Hi @shellscape,
Unfortunately, corepack is experimental now, so we would not implement that at least while its not become stable.
That is why I will close this issue now. If you have any questions or concerns, please feel free to leave a comment on this thread or open another issue.
shellscape commentedon May 4, 2022
Hm, I don't see anything codified in this repo that states experimental features aren't welcome. Seems that a
experimentalproperty would be a very good fit here. I think this was closed prematurely.styfle commentedon May 4, 2022
A PR was already started in #482
Also, we should get clarity around the path from experimental to stable nodejs/corepack#104
shellscape commentedon May 4, 2022
@styfle ah I missed that, thanks for pointing it out. I'll continue discussion there.
dmitry-shibanov commentedon May 4, 2022
Hello @shellscape. I think the main reason to not enable corepack by default because some customers can use setup-node with cache enable in conjunction with pnpm/action-setup before setup-node. When corepack is enabled it will override preinstalled pnpm (from pnpm/action-setup).
For example users can specify use the latest version of pnpm (7th), but corepack can override it to 6th. This also applies to yarn.
Ethan-Arrowood commentedon May 4, 2022
corepack will not override it to 6 unless that is what is set for
packageManagerdmitry-shibanov commentedon May 4, 2022
Hello @Ethan-Arrowood. Thank you for your response. I've tried to use this snippet and it overrides pnpm version.
Ethan-Arrowood commentedon May 4, 2022
Is
packageManagerin your package.json set topnpm@7.0.0?dmitry-shibanov commentedon May 4, 2022
No it does not. With packageManager it works as expected. But not all users have packageManager field, that is why it can break existing behaviour some users if corepack is enabled by default with caching.
viceice commentedon May 5, 2022
it makes no sense to setup pnpm before node. 🤔
6 remaining items
chore(deps-dev): bump prettier from 2.8.3 to 2.8.4 (actions#480)
naXa777 commentedon Nov 21, 2023
is this change released?
Now for users who used a separate step to enable corepack, the github action is broken. Hence the declared goal of this change request is not met: "which is a net benefit to users in both regards".
sample yaml:
The step "Setup Node.js" fails with error:
The step "Enable corepack" that follows is not executed, cause the action is already failed.
darkbasic commentedon Nov 21, 2023
Yeah I've noticed that as well. Initially it started happening randomly and re-triggering the CI fixed it, but now it happens consistently. The solution is to enable corepack before setup-node. I hope that one day setup-node will officially support corepack and such hacks won't be necessary anymore.
BeroBurny commentedon Nov 21, 2023
like we had
cache: 'yarn'in configafter removing it solved the problem 🤷♂️
but found it after applied @darkbasic solution
fix(ci): enable corepack sooner
fix(ci): fix corepack setup fail
dylants commentedon Jan 29, 2024
Explicitly putting together what others have said, this worked for me:
shawnmclean commentedon Jun 24, 2024
man, how come I have to find these things in a gh issue?
Is this officially documented anywhere?
I'm in the process of upgrading something to yarn 4 from 1 and couldn't find anything on github actions.
webapp: use fixed version of yarn
Push up enable corepack
Try this solution for yarn2/corepack
Try this solution for yarn2/corepack
ci: Fix yarn remaining in v1.22.22 in GitHub Actions
Fix CodeQL issues for checked-in yarn binaries (#1017)
SethFalco commentedon May 25, 2025
Thanks, @dylants, for sharing your solution in #480 (comment). It did not work for me as-is, however did resolve the immediate problem, which helped me get to a final solution for my project.
I have a library, where all unit tests are run on a matrix of Windows and Linux, and then also for Node.js v16, v18, v20, and v22.
Dylan's solution worked for the following:
To fix runs on Linux with Node.js v16, I had to override the version of corepack to v0.20.0, the latest version available with Node.js v16 support, instead of using the one bundled with Node.js:
steps: - uses: actions/checkout@v4 + - run: npm install -g corepack@0.20.0 - run: corepack enable - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn installThen to fix things for Windows, I had to add
--forceto let npm know it can replace the global version of Yarn:steps: - uses: actions/checkout@v4 - - run: npm install -g corepack@0.20.0 + - run: npm install -g corepack@0.20.0 --force - run: corepack enable - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn installReference: svg/svgo#2138