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

Clarify recommended package manager #1645

Open
mcandre opened this issue Nov 10, 2021 · 4 comments
Open

Clarify recommended package manager #1645

mcandre opened this issue Nov 10, 2021 · 4 comments
Labels

Comments

@mcandre
Copy link

mcandre commented Nov 10, 2021

Node.js still comes with npm as the default package manager. And the official Node.js online documentation continues to list npm commands. However, the official Node.js Docker Hub images strangely contain yarn by default, which is not lockfile compatible with npm.

So which of these two package managers should Node.js users be using? If the answer is npm, then would be good to drop yarn from the next major Node.js release series tags on Docker Hub, in order to provide leaner images. This reduces confusion, storage costs, and network bills.

@aduh95
Copy link
Contributor

aduh95 commented Nov 10, 2021

would be good to drop yarn from the next major Node.js release series tags on Docker Hub, in order to provide leaner images. This reduces confusion, storage costs, and network bills.

Same apply for npm, do you think we should remove both?

So which of these two package managers should Node.js users be using?

Yarn, npm, and Node.js are three distinct projects, with different goals. Node.js users should use whatever suits their use case and their own preference (none, both, another package manager such as pnpm, etc.).

@richardlau
Copy link
Member

Since this is specifically about the Docker images I'm going to transfer this over to https://github.com/nodejs/docker-node as the Docker working group has autonomy for what goes into those images.

@richardlau richardlau transferred this issue from nodejs/node Feb 17, 2022
@bri3d
Copy link

bri3d commented Feb 17, 2022

I am a strong advocate for the removal of both package managers from the blessed Docker images.

Package managers introduce a dependency surface area which makes the docker-node images harder to use in an audited corporate environment and limits their utility. Right now we take the base image, tag an image which uninstalls all package managers from the base image, and then copy our production Node app and dependencies into that image. It would be great not to have to do this, IMO a base image should be a base image.

It makes much more sense to me to install the package manager that a specific project needs as part of that specific project's build steps than to have multiple package managers included in a base image, as package mangers are a project specific dev dependency.

Otherwise, users are exposed to these sorts of annoying issues: npm/cli#3785 by default.

@SimenB
Copy link
Member

SimenB commented Feb 18, 2022

Discussion about no package manager is duplicate of #404.
Discussion about only npm, no yarn is duplicate of #777.

(and note that node itself is embracing more than just npm, ref https://nodejs.org/api/corepack.html, which is available in the current LTS).


I think we should close this issue, whatever discussion comes out of it are covered in other, existent issues.

/cc @nodejs/docker

dunglas added a commit to dunglas/docker-node that referenced this issue Sep 7, 2022
This patch enables Corepack, allowing to use pnpm directly
and unbundling yarn from the default image.

Removing yarn also simplifies the image and the maintainance.

This change as been discussed in
nodejs#777.

Closes nodejs#777, nodejs#1645, nodejs#1755.
dunglas added a commit to dunglas/docker-node that referenced this issue Sep 7, 2022
This patch enables Corepack, allowing to use pnpm directly
and unbundling yarn from the default image.

Removing yarn also simplifies the image and the maintenance.

This change has been discussed in
nodejs#777.

Closes nodejs#777, nodejs#1645, nodejs#1755.
dunglas added a commit to dunglas/docker-node that referenced this issue Sep 7, 2022
This patch enables Corepack, allowing to use pnpm directly
and unbundling yarn from the default image.

Removing yarn also simplifies the image and the maintenance.

This change has been discussed in
nodejs#777.

Closes nodejs#777, nodejs#1645, nodejs#1755.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants
@mcandre @bri3d @SimenB @richardlau @Ayase-252 @aduh95 and others