Skip to content

Add corepack (instead of yarn) #12310

Closed as not planned
Closed as not planned

Description

@SpecLad

Tool name

corepack

Tool license

MIT

Add or update?

  • Add
  • Update

Desired version

latest

Approximate size

1 MB (however, it's smaller than yarn, so this will actually decrease the image size)

Brief description of tool

Corepack provides shims for the Yarn and pnpm package managers that automatically download and run the version of the manager defined in package.json. Adding Corepack to the base image will let projects using pnpm and Yarn 2+ run these tools without an extra install step.

Currently, the runner images include Yarn 1.x. This should be deleted, as it will conflict with Corepack's yarn shim. The shim also uses Yarn 1.x by default in most cases, so most workflows should be unaffected by this change. The only observable incompatibility I could find is that yarn init will use Yarn 4.x if ran outside a project directory; however, since this command creates a new project, I would not expect to see it in a CI workflow.

URL for tool's homepage

https://github.com/nodejs/corepack

Provide a basic test case to validate the tool's functionality.

yarn --version
pnpm --version

Platforms where you need the tool

  • Azure DevOps
  • GitHub Actions

Runner images where you need the tool

  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Can this tool be installed during the build?

npm install -g corepack

# Note that currently Node.js bundles a version of corepack where the shims are disabled by default.
# This version is slated to be removed in Node 25, so I think it's best to ignore it,
# and just install the latest from NPM.

Tool installation time in runtime

Negligible

Are you willing to submit a PR?

Probably not

Activity

  1. SpecLad commented on Jun 3, 2025

    @SpecLad
    Author

    FYI, I didn't tick any of the runner image checkboxes, since it seems to me that the best time to implement this will be when adding the next generation of operating systems. But I won't mind if this is implemented in existing images as well.

  2. kishorekumar-anchala commented on Jun 4, 2025

    @kishorekumar-anchala
    Contributor

    Hi @SpecLad ,

    Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.


  3. MikeMcC399 commented on Jun 16, 2025

    @MikeMcC399

    Please don't remove Yarn Classic! This would be a breaking change!

    corepack is not a drop-in substitute for Yarn Classic

    Currently corepack is already part of all base images, since it is still bundled with Node.js. This is planned to change however - see Node.js 24 documentation corepack

  4. MikeMcC399 commented on Jun 16, 2025

    @MikeMcC399

    Before deciding to add a separately installed version of corepack to GitHub runner images, I suggest that a review of corepack open issues should be done.

    The latest release is currently corepack@0.33.0.

    Corepack releases 0.y.z follow Semantic Versioning Specification for initial development and by this definition should not be considered stable. Corepack released through Node.js additionally carries the label Experimental - see Node.js documentation corepack and therefore not suitable for production usage.

  5. SpecLad commented on Jun 16, 2025

    @SpecLad
    Author

    Please don't remove Yarn Classic! This would be a breaking change!

    Could you clarify how breaking it would be? As I've mentioned in my initial post, the only incompatibility I could find was with yarn init, which is not something I'd expect to see in a CI pipeline.

  6. MikeMcC399 commented on Jun 16, 2025

    @MikeMcC399

    @SpecLad

    Please don't remove Yarn Classic! This would be a breaking change!

    Could you clarify how breaking it would be?

    I don't think I'm able to say what it might break as that would mean that I knew about all GitHub workflows using Yarn Classic. It seems like a very courageous act to remove Yarn Classic and then rely on corepack.

    As I've mentioned in my initial post, the only incompatibility I could find was with yarn init, which is not something I'd expect to see in a CI pipeline.

    https://github.com/eslint/css/blob/main/.github/workflows/ci-build-all-pm.yml is an example of a workflow using yarn init (albeit with Yarn Modern, not Yarn Classic), however it does show that the assumption that yarn init is never used in any workflow is not correct.

  7. SpecLad commented on Jun 16, 2025

    @SpecLad
    Author

    I don't think I'm able to say what it might break as that would mean that I knew about all GitHub workflows using Yarn Classic.

    I mean... you're the one saying that this would be a breaking change. How can you claim this if you don't know what would break?

  8. MikeMcC399 commented on Jun 17, 2025

    @MikeMcC399

    @SpecLad

    I don't think I'm able to say what it might break as that would mean that I knew about all GitHub workflows using Yarn Classic.

    I mean... you're the one saying that this would be a breaking change. How can you claim this if you don't know what would break?

    You're right. I've claimed it's a breaking change without providing any concrete example of a workflow where it would break. I will see if I can find any.

  9. sangeeths03 commented on Jun 18, 2025

    @sangeeths03
    Contributor

    Hi @SpecLad ,
    We are sorry to inform you that at this point in time, it is difficult to add this tool to our images.
    Having said that we will surely re-evaluate the possibility of addition of this tool.
    However, we will consider including this tool if more users want it.
    Hence closing this feature request as of now.
    Thanks.

  10. jasikpark commented on Jun 18, 2025

    @jasikpark

    However, we will consider including this tool if more users want it.
    Hence closing this feature request as of now.

    What's the best way to provide feedback that we are users of corepack who would benefit from support?

  11. MikeMcC399 commented on Jun 19, 2025

    @MikeMcC399

    Re-reading the original post, it doesn't seem clear that corepack is already included in GitHub runner images.

    Each GitHub runner image ships with an LTS version of Node.js and these include a bundled version of corepack (currently either corepack@0.31.0 or corepack@0.32.0, depending on the Node.js version installed in the runner).

    The Node.js release process is continuing to update the bundled version of corepack in Node.js. For instance, nodejs/node#58665 to release Node.js 22.17.0 updates corepack to 0.33.0.

    So currently all GitHub runners do ship with corepack, however it is only a recent version, not necessarily corepack@latest.

    According to the Node.js release scheme, the situation will need revisiting at the latest when the future Node.js 26 is promoted to LTS in October 2026. It will also become relevant at an earlier date, when Node.js 25 is released in October 2025 (see https://nodejs.org/docs/latest-v24.x/api/corepack.html where Node.js states "Corepack will no longer be distributed starting with Node.js v25.") and actions/setup-node is being used to install an alternate version of Node.js.

  12. SpecLad commented on Jun 21, 2025

    @SpecLad
    Author

    According to the Node.js release scheme, the situation will need revisiting at the latest when the future Node.js 26 is promoted to LTS in October 2026.

    FWIW, I specifically requested that corepack be installed from NPM so that the situation wouldn't need to be revisited later.

  13. MikeMcC399 commented on Jun 22, 2025

    @MikeMcC399

    @SpecLad

    According to the Node.js release scheme, the situation will need revisiting at the latest when the future Node.js 26 is promoted to LTS in October 2026.

    FWIW, I specifically requested that corepack be installed from NPM so that the situation wouldn't need to be revisited later.

    The remark about revisiting the situation was more concerned with how the status of Corepack might develop in the future. Corepack has been classed as not recommended in production environments since its introduction into Node.js 14.19.0 in Feb 2022. See also #12310 (comment) (above).

    The Node.js Technical Steering Committee took a vote in March 2025, which resulted in plans to remove Corepack from Node.js distribution, no change to Corepack being enabled by default (which npm install -g corepack does in fact enable) and no change to its experimental status.

    It is possible that Corepack develops further and is able to release a stable v1.0.0 release, in which case it would be a candidate for use in production and GitHub staff may be able to reconsider adding it to GitHub runner images.

    The requirements and request for this is covered in issue Release corepack@1.0.0, which you may like to subscribe to.

  14. added a commit that references this issue on Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions