From 4ae5c0b4f36ec35bf382989b4c796eec64f81fd1 Mon Sep 17 00:00:00 2001 From: Frank Calise Date: Mon, 20 Nov 2023 11:36:47 -0500 Subject: [PATCH] fix(cli): pnpm npmrc (#2561 by @frankcalise @morganick) --- src/commands/new.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/commands/new.ts b/src/commands/new.ts index 6c2fe09fa..2fcd1d73d 100644 --- a/src/commands/new.ts +++ b/src/commands/new.ts @@ -575,6 +575,14 @@ module.exports = { // #region Run Packager Install // pnpm/yarn/npm/bun install it + // fix .npmrc if using pnpm + if (packagerName === "pnpm") { + // append `node-linker=hoisted` to .npmrc + const npmrcPath = path(targetPath, ".npmrc") + const npmrcContents = read(npmrcPath) + write(npmrcPath, `${npmrcContents}${EOL}node-linker=hoisted${EOL}`) + } + // check if there is a dependency cache using a hash of the package.json const boilerplatePackageJsonHash = cache.hash(read(path(boilerplatePath, "package.json"))) const cachePath = path(cache.rootdir(), boilerplatePackageJsonHash, packagerName)