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
{{ message }}
Repository navigation
Decision about yarn in images for next semver-major of Node.js #1979
The decision to include yarn into the image has had some mixed reaction and the departure from staying with the default installation of the Node package leads to a lot of disagreement.
Node 21 was just released so we now have the opportunity to not include Yarn by default in this new version and maybe add a variant that has yarn. What do people think?
iMO, this issue should be resolved before adding v21.
There have been a lot of responses to feature requests in this repo along the lines of "we ship what Node.js ships, and nothing more". I believe this stance is very reasonable for the official Node.js images. I also think that implies yarn should not be shipped, or it would be inconsistent.
As discussed in #777 and other issues, package managers (and that includes npm) contribute a lot to the image size especially for Alpine-based images. If we can't decide on a variant for multi-stage builds that ships entirely without any package managers, perhaps we can find common ground by at least eliminating yarn.
One could make the argument that a lot of people are using yarn, but then again, a lot of people are using pnpm, and recently maybe bun, and those aren't included.
When defining a custom image, it's really quite simple to add an install command for additional package managers as needed. On the other hand, it can be tricky to remove existing parts of an image without breaking things. As such, I think the default should be an image that includes as little additional stuff as possible.
I haven't been following what's happening with corepack. If corepack is now on by default in 21, I think it makes it an easier sell that directions on how to use Yarn could be replaced
I see no reason to hold off on releasing a v21 image on this.
v21 will be EOL in about 9 months anyways (way before e.g. Node 20 which already ships with Yarn), so removing it for newer versions now will just increase maintenance/fragmentation, not lower it. v22 is a better release to consider it as that will turn LTS and stick around for a long time.
And yes, corepack is probably the solution, just as it has been in the numerous other discussions we've had on this. It's still considered experimental, however (also in 21).
And I'm also (still) of the opinion we should just not ship a package manager at all if the point is to save on size.
The decision to include yarn into the image has had some mixed reaction and the departure from staying with the default installation of the Node package leads to a lot of disagreement.
Can you point to any recent discussions around this?
Happy to explore the latest one (#1768) - the others are more than 3 years old, so at least to me it doesn't seem to have much momentum/requests behind it.
I think it's either you bundle the Node docker image with the popular other package managers (pnpm, yarn, etc) or you just keep it only with npm and people can install their own preferred package manager alternative for npm
If nodejs/node#51886 lands, what would happen to the Yarn that’s included in the Docker image? Would we just stop including Yarn 1, and /usr/local/bin/yarn would be a symlink to Corepack, the way it is after you run corepack enable? I assume that would be fine, if done as a semver-major change?
I've been wanting to remove the preinstalled version and run corepack enable instead for some time, so if it that's kinda what Node itself decides to do in v22, then I think we'd just remove our own manual installation like you outline. 👍
We could probably then add a "core" version or something with just Node (so removing yarn, corepack, npm, npx etc) for those that don't want the "bloat". We've had requests for that for a long time.
Ah, right! I think that's probably fine. You don't need the package manager unless you're gonna install things, at which point you have internet to download the package manager anyways. If we go with a "core" image as well, we can probably run some command to preinstall, but that's a separate discussion.
So I believe the Node.js organization needs to reconsider whether this outdated Yarn v1 version should continue to be bundled with Docker images. It's unsupported and untested in CI on currently supported Node.js versions 20, 22 & 24.
Also, since this issue here was started, the Node.js Technical Steering Committee voted on Mar 19, 2025 for the strategy decision:
Phase out later: stop distributing Corepack (i.e. the distribution will no longer contain a corepack executable) on future (i.e. 25+) release lines of Node.js – existing release lines as well as the very next (i.e. 24.x) will keep it as experimental.
Perhaps this older issue (which has the title "Decision about yarn in version 21 of node") should be closed and the discussion continued in the newer #2264? Node.js 21 already reached end-of-life some time ago on June 1, 2024.
Why is yarn even included in slim images? Same question for npm? We want the tiniest possible containers to execute scripts with Node.js. These containers are not meant to be used to build things; they are meant as runtimes. They don't need either yarn or any other package managers, which are only needed in the builder images.
We always end up having to remove them all (npm, yargs, various symlinks, environment variables), which is a pain.
changed the title [-]Decision about yarn in version 21 of Node[/-][+]Decision about `yarn` in images for next semver-major of Node.js[/+]on Jan 29, 2026
Renaming the issue means there are now duplicate issues open, as the newer #2264 covers the same topic.
It would be good to consolidate into one open issue to avoid parallel discussions. #2264 has the newer set of discussions, including a comment about the Yarn 6 preview announcement.
I added #2264 (comment) to carry over the proposal from this issue into the newer issue based on removing Yarn v1 Classic from the next semver-major of Node.js Docker images, which would be Node.js 26.
Activity
meyfa commentedon Oct 17, 2023
There have been a lot of responses to feature requests in this repo along the lines of "we ship what Node.js ships, and nothing more". I believe this stance is very reasonable for the official Node.js images. I also think that implies yarn should not be shipped, or it would be inconsistent.
As discussed in #777 and other issues, package managers (and that includes npm) contribute a lot to the image size especially for Alpine-based images. If we can't decide on a variant for multi-stage builds that ships entirely without any package managers, perhaps we can find common ground by at least eliminating yarn.
One could make the argument that a lot of people are using yarn, but then again, a lot of people are using pnpm, and recently maybe bun, and those aren't included.
When defining a custom image, it's really quite simple to add an install command for additional package managers as needed. On the other hand, it can be tricky to remove existing parts of an image without breaking things. As such, I think the default should be an image that includes as little additional stuff as possible.
nschonni commentedon Oct 17, 2023
I haven't been following what's happening with corepack. If corepack is now on by default in 21, I think it makes it an easier sell that directions on how to use Yarn could be replaced
SimenB commentedon Oct 17, 2023
I see no reason to hold off on releasing a v21 image on this.
v21 will be EOL in about 9 months anyways (way before e.g. Node 20 which already ships with Yarn), so removing it for newer versions now will just increase maintenance/fragmentation, not lower it. v22 is a better release to consider it as that will turn LTS and stick around for a long time.
And yes, corepack is probably the solution, just as it has been in the numerous other discussions we've had on this. It's still considered experimental, however (also in 21).
And I'm also (still) of the opinion we should just not ship a package manager at all if the point is to save on size.
Can you point to any recent discussions around this?
LaurentGoderre commentedon Oct 18, 2023
Just to list a few:
#1768
#1245
#1238
#777
#898
#808
SimenB commentedon Oct 24, 2023
Happy to explore the latest one (#1768) - the others are more than 3 years old, so at least to me it doesn't seem to have much momentum/requests behind it.
(this is just my personal opinion, tho)
GeoffreyBooth commentedon Jan 11, 2024
It seems especially odd that we’d bundle Yarn 1, when the current version is 4. Especially since Yarn 1.x seems to be abandoned and has issues.
weyert commentedon Jan 30, 2024
I think it's either you bundle the Node docker image with the popular other package managers (pnpm, yarn, etc) or you just keep it only with
npmand people can install their own preferred package manager alternative fornpmGeoffreyBooth commentedon Mar 3, 2024
If nodejs/node#51886 lands, what would happen to the Yarn that’s included in the Docker image? Would we just stop including Yarn 1, and
/usr/local/bin/yarnwould be a symlink to Corepack, the way it is after you runcorepack enable? I assume that would be fine, if done as a semver-major change?cc @aduh95 @nodejs/corepack
SimenB commentedon Mar 4, 2024
I've been wanting to remove the preinstalled version and run
corepack enableinstead for some time, so if it that's kinda what Node itself decides to do in v22, then I think we'd just remove our own manual installation like you outline. 👍We could probably then add a "core" version or something with just Node (so removing yarn, corepack, npm, npx etc) for those that don't want the "bloat". We've had requests for that for a long time.
GeoffreyBooth commentedon Mar 4, 2024
If we change the symlink to point to Corepack, then there would be no version of Yarn included with the image. It would be downloaded on first use.
SimenB commentedon Mar 4, 2024
Ah, right! I think that's probably fine. You don't need the package manager unless you're gonna install things, at which point you have internet to download the package manager anyways. If we go with a "core" image as well, we can probably run some command to preinstall, but that's a separate discussion.
monecchi commentedon Mar 17, 2024
MikeMcC399 commentedon Oct 1, 2025
Yarn v1 included in node Docker images:
So I believe the Node.js organization needs to reconsider whether this outdated Yarn v1 version should continue to be bundled with Docker images. It's unsupported and untested in CI on currently supported Node.js versions 20, 22 & 24.
Also, since this issue here was started, the Node.js Technical Steering Committee voted on Mar 19, 2025 for the strategy decision:
Perhaps this older issue (which has the title "Decision about yarn in version 21 of node") should be closed and the discussion continued in the newer #2264? Node.js 21 already reached end-of-life some time ago on June 1, 2024.
arcanis commentedon Oct 1, 2025
We (Yarn) plan to make changes to our installation strategy in a month or two, let's please wait a bit before making any change around that.
ericmorand commentedon Nov 10, 2025
Why is yarn even included in slim images? Same question for npm? We want the tiniest possible containers to execute scripts with Node.js. These containers are not meant to be used to build things; they are meant as runtimes. They don't need either yarn or any other package managers, which are only needed in the builder images.
We always end up having to remove them all (npm, yargs, various symlinks, environment variables), which is a pain.
MikeMcC399 commentedon Jan 29, 2026
I would repeat the suggestion to close this issue which is about Node.js 21 that reached end-of-life 18 months ago.
[-]Decision about yarn in version 21 of Node[/-][+]Decision about `yarn` in images for next semver-major of Node.js[/+]aduh95 commentedon Jan 29, 2026
There's nothing specific about Node.js 21.x AFAICT, I've renamed the issue instead.
Also, on the topic, Yarn project has announced a new distribution method: https://yarn6.netlify.app/blog/2026-01-28-yarn-6-preview/#yarn-switch
MikeMcC399 commentedon Jan 29, 2026
@aduh95
Renaming the issue means there are now duplicate issues open, as the newer #2264 covers the same topic.
It would be good to consolidate into one open issue to avoid parallel discussions. #2264 has the newer set of discussions, including a comment about the Yarn 6 preview announcement.
MikeMcC399 commentedon Jan 29, 2026
@aduh95
Thanks for closing this issue!
I added #2264 (comment) to carry over the proposal from this issue into the newer issue based on removing Yarn v1 Classic from the next semver-major of Node.js Docker images, which would be Node.js 26.