From a5ddb85990bb1a48338172a275e899f4401a0fb9 Mon Sep 17 00:00:00 2001 From: Ron Spickenagel Date: Fri, 5 Jul 2024 21:03:24 -0400 Subject: [PATCH] fix: Yarn workspace incorrectly resolves node_modules path during script execution (fixes #4564) --- src/util/execute-lifecycle-script.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index f5db0821b4..6d0bb33f61 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -195,7 +195,12 @@ export async function makeEnv( pathParts.unshift(path.join(config.workspaceRootFolder, binFolder)); } pathParts.unshift(path.join(config.linkFolder, binFolder)); - pathParts.unshift(path.join(cwd, binFolder)); + + let realBinFolder = path.join(cwd, binFolder); + if (await fs.exists(realBinFolder)) { + realBinFolder = await fs.realpath(realBinFolder); + } + pathParts.unshift(realBinFolder); } let pnpFile;