Skip to content

docs: align corepack installation instructions - #7094

Closed
MikeMcC399 wants to merge 1 commit into
yarnpkg:masterfrom
MikeMcC399:corepack-install
Closed

MikeMcC399 wants to merge 1 commit into
yarnpkg:masterfrom
MikeMcC399:corepack-install

Conversation

@MikeMcC399

@MikeMcC399 MikeMcC399 commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

What's the problem this PR addresses?

The Installation page says to install Corepack with:

npm install -g corepack

The Corepack page gives different information, which is partially outdated:

Corepack is included with all official Node.js releases starting from Node.js 14.19 / 16.9. It's however opt-in for the duration of the experimental stage, so you'll need to run corepack enable before it's active.

As described in the Node.js Distribution Policy

corepack was added in Node.js 14.9.0 and 16.9.0. It is no longer distributed as of Node.js 25.0.0.

Also, according to nodejs/corepack#686, installing with npm install -g corepack automatically enables Corepack.

How did you fix it?

Make documentation changes to packages/docusaurus/docs/getting-started/extra/corepack.mdx to be published to the Corepack page.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

Preview

https://deploy-preview-7094--yarn4.netlify.app/corepack#installation

@MikeMcC399 MikeMcC399 mentioned this pull request Apr 6, 2026
3 tasks done
@fulldecent

Copy link
Copy Markdown
Contributor

This adds the note:

Alternatively, Corepack is included in supported Node.js versions lower than Node.js 25.0.0. Run corepack enable to activate it.

But I think the instructions could be more prescriptive and explicit. Does Node.js 24 also work with the npm install -g corepack command? What about Node version 1? That probably doesn't include Corepack.

I would hope to see the preferred command npm install -g corepack, a clear promise of exactly which versions of Node this will work with, and the same thing for any other proposed commands.

I recognize that there may be overlap. Maybe some versions of Node support /either/ npm install -g corepack or corepack enable to get it working. This is helpful to know because my projects support multiple versions of Node (and especially in continuous integration) so I am responsible for making /every/ supported version of Node work. And if I can do that for all my supported versions, and all future versions with one command then that would be helpful to know.

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

Supported versions of Node.js are listed on Node.js release: currently Node.js 20, 22, 24 & 25.

npm install -g corepack can be used with any of the supported versions of Node.js.

If you install with npm install -g corepack, then Corepack is automatically enabled. Executing corepack enable on top is unnecessary, but if you do execute it, Corepack will still be enabled.

Yarn 4 has a minimum requirement of Node.js 18.12, so I believe that this would be the lowest version that needs to be documented. See https://yarnpkg.com/advanced/changelog#400

With Node.js 16's now being End of Life'd, we dropped support for Node.js versions lower than 18.12.

At the end of this month on 2026-04-30 Node.js 20 also transitions into end-of-life status.

@fulldecent

Copy link
Copy Markdown
Contributor

I tried implementing this in one of my projects (example runs).

The most reliable way for me to enable corepack in any version of Node.js from 18.12 through current has been:

corepack enable || npm install -g corepack

This one command works in any version of Node.js that Yarn Berry supports and it results in Yarn being immediately able to run afterwards. It works in any environment, including vanilla installs as well custom runners. And it runs in the fastest runtime in every circumstance.

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

@fulldecent

Thanks for sharing your command!

@arcanis

arcanis commented Apr 7, 2026

Copy link
Copy Markdown
Member

Note that, for Yarn, our plan will be to recommend using Yarn Switch once it's stable (end of summer?).

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

@arcanis

Note that, for Yarn, our plan will be to recommend using Yarn Switch once it's stable (end of summer?).

Will that work with Yarn Berry or only with Yarn Zpm?

@arcanis

arcanis commented Apr 7, 2026

Copy link
Copy Markdown
Member

It supports all versions of Yarn (classic, berry, and zpm)

@MikeMcC399

MikeMcC399 commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor Author

@arcanis

Will you still consider this PR or do you want to freeze the text until Yarn Switch can replace Corepack?

@fulldecent

Copy link
Copy Markdown
Contributor

You say it supports (installing) all versions of Yarn. But will the Yarn classic release a new version that includes Yarn Switch by default?

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

The rest of the Corepack page describing strategy is also out of date, however I can't provide those details, so perhaps the page should just be frozen until Switch is ready?

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

Withdrawing this suggestion, as the whole Corepack page needs revising, and I'm not able to provide this input since it concerns strategy and future plans.

@fulldecent

Copy link
Copy Markdown
Contributor

I think the published version now resolves the issues we discussed here.

https://yarnpkg.com/getting-started/install

@MikeMcC399

Copy link
Copy Markdown
Contributor Author

https://yarnpkg.com/corepack remains outdated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants