如何不同项目使用不同版本的pnpm
nbstudy 发表于 2024-06-25 13:46:01
Using Corepack
Since v16.13
, Node.js is shipping Corepack for managing package managers. This is an experimental feature, so you need to enable it by running:
bash
corepack enable pnpm
If you installed Node.js using Homebrew, you'll need to install corepack separately:
You can pin the version of pnpm used on your project using the following command:
bash
corepack use pnpm@latest
This will add a "packageManager" field in your local package.json which will instruct Corepack to always use a specific version on that project. This can be useful if you want reproducability, as all developers who are using Corepack will use the same version as you. When a new version of pnpm is released, you can re-run the above command.