升级全局版本


¥Upgrading the global versions

当在现有项目之外运行时(例如运行 yarn init 时),Corepack 将默认使用与每个工具的最新稳定版本大致对应的预定义版本。可以通过运行 corepack prepare 命令以及你希望设置的包管理器版本来覆盖这些版本:

¥When running outside of an existing project (for example when running yarn init), Corepack will by default use predefined versions roughly corresponding to the latest stable releases from each tool. Those versions can be overridden by running the corepack prepare command along with the package manager version you wish to set:

corepack prepare yarn@x.y.z --activate 

或者,可以使用标签或范围:

¥Alternately, a tag or range may be used:

corepack prepare pnpm@latest --activate
corepack prepare yarn@stable --activate