Corepack is an experimental tool introduced in Node.js 16.9.0 that provides a bridge between Node.js projects and package managers like Yarn and pnpm. It acts as a zero-runtime-dependency Node script that allows developers to use these package managers without having to install them globally on their development machines or build servers. [1] [2] [3] [4]
The controversy surrounding enabling Corepack by default stems from various concerns and debates within the Node.js community. The main points of contention include:
-
Distribution through Corepack: npm firmly opposes distribution through Corepack due to technical issues and concerns about npm support being forced on by default. They highlight problems such as unclear package manager versions, potential security vulnerabilities, and the burden of managing package manager updates.
-
Removal of npm from Node.js Binary: There is a discussion about whether the goal of enabling Corepack is to remove npm from the Node.js binary, which is seen as a strategic move to address npm’s historical dominance and promote alternatives. Some believe that Node.js should focus on bundle size and consider the strategic advantages of npm over others.
-
Package Manager Independence: Corepack is intended to provide a level playing field for alternative package managers, potentially reducing npm’s dominance and increasing the adoption of other package managers. However, this has led to disagreements on how to proceed and what the ultimate objectives are.
-
Onboarding Experience: Corepack is designed to ease new contributor onboarding by ensuring that everyone on the team uses the exact package manager version intended, without manual synchronization.
-
Global vs Local Use: While npm is listed as a valid option in the “packageManager” property, the lack of a shim in Corepack means that the global npm will be used instead. This distinction is important for those who prefer to use npm locally within projects configured with other package managers.
At the end of the day, the drama around enabling Corepack by default revolves around the balance between promoting alternative package managers and preserving npm’s role in the Node.js ecosystem, as well as technical and philosophical debates within the Node.js community.