Skip to content
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

Decision about yarn in version 21 of Node #1979

Open
LaurentGoderre opened this issue Oct 17, 2023 · 12 comments
Open

Decision about yarn in version 21 of Node #1979

LaurentGoderre opened this issue Oct 17, 2023 · 12 comments

Comments

@LaurentGoderre
Copy link
Member

LaurentGoderre commented Oct 17, 2023

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.

@meyfa
Copy link

meyfa commented 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
Copy link
Member

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
Copy link
Member

SimenB commented 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).

image

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?

@LaurentGoderre
Copy link
Member Author

Just to list a few:

#1768
#1245
#1238
#777
#898
#808

@SimenB
Copy link
Member

SimenB commented 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
Copy link
Member

GeoffreyBooth commented 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
Copy link

weyert commented 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 npm and people can install their own preferred package manager alternative for npm

@GeoffreyBooth
Copy link
Member

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?

cc @aduh95 @nodejs/corepack

@SimenB
Copy link
Member

SimenB commented Mar 4, 2024

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.

@GeoffreyBooth
Copy link
Member

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
Copy link
Member

SimenB commented 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

This comment was marked as off-topic.

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

No branches or pull requests

7 participants