确定包管理器
¥Determining package manager
¥Stability: 1 - Experimental
虽然所有 Node.js 项目在发布后都可以由所有包管理器安装,但他们的开发团队通常需要使用特定的包管理器。为了使这个过程更容易,Node.js 附带了一个名为 Corepack 的工具,旨在使所有包管理器在你的环境中透明地可用 - 前提是你安装了 Node.js。
¥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.
默认情况下,Corepack 不会强制执行任何特定的包管理器,并将使用与每个 Node.js 版本关联的通用 "最后一次为人所知" 版本,但你可以通过在项目的 package.json
中设置 "packageManager"
字段来改善这种体验。
¥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
.