确定包管理器


稳定性: 1 - 实验

虽然所有 Node.js 项目在发布后都可以由所有包管理器安装,但他们的开发团队通常需要使用特定的包管理器。 为了使这个过程更容易,Node.js 附带了一个名为 Corepack 的工具,旨在使所有包管理器在您的环境中透明可用,只要您安装了 Node.js

默认情况下,Corepack 不会强制执行任何特定的包管理器,而是使用与每个 Node.js 版本相关联的通用“最后一次正确”版本,但您可以通过在项目的 package.json 中设置 "packageManager" 字段来改善这种体验。

Stability: 1 - Experimental

While all Node.js projects are expected to be installable by all package managers once published, their development teams are often required to use one specific package manager. To make this process easier, Node.js ships with a tool called Corepack that aims to make all package managers transparently available in your environment - provided you have Node.js installed.

By default Corepack won't enforce any specific package manager and will use the generic "Last Known Good" versions associated with each Node.js release, but you can improve this experience by setting the "packageManager" field in your project's package.json.