diff --git a/.changeset/angry-bobcats-develop.md b/.changeset/angry-bobcats-develop.md new file mode 100644 index 00000000000..a1de02d9fe9 --- /dev/null +++ b/.changeset/angry-bobcats-develop.md @@ -0,0 +1,6 @@ +--- +"@pnpm/plugin-commands-installation": patch +"pnpm": patch +--- + +`pnpm link -g ` should not modify the `package.json` file [#4341](https://github.com/pnpm/pnpm/issues/4341). diff --git a/pkg-manager/plugin-commands-installation/src/link.ts b/pkg-manager/plugin-commands-installation/src/link.ts index 872f732f9b1..e58f93d0df6 100644 --- a/pkg-manager/plugin-commands-installation/src/link.ts +++ b/pkg-manager/plugin-commands-installation/src/link.ts @@ -200,7 +200,9 @@ export async function handler ( storeDir: storeL.dir, manifest, } as LinkFunctionOptions) - await writeProjectManifest(newManifest) + if (!opts.cliOptions?.global) { + await writeProjectManifest(newManifest) + } await Promise.all( Array.from(storeControllerCache.values())