Skip to content

Commit d13e193

Browse files
committed
fix: set YARN_NODE_LINKER=node-modules for yarn dlx commands
Yarn PnP mode fails when packages have undeclared dependencies (e.g. @coana-tech/cli accessing @babel/types). Setting the YARN_NODE_LINKER env var to node-modules forces traditional node_modules resolution, avoiding PnP strict dependency errors.
1 parent 5e9e01d commit d13e193

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/utils/dlx.mts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ export async function spawnDlx(
147147
}
148148
spawnArgs.push(packageString, ...args)
149149

150+
// Use node-modules linker instead of PnP to avoid issues with packages
151+
// that have undeclared dependencies (e.g. @coana-tech/cli -> @babel/types).
152+
finalShadowOptions = {
153+
...finalShadowOptions,
154+
env: {
155+
...getOwn(finalShadowOptions, 'env'),
156+
YARN_NODE_LINKER: 'node-modules',
157+
},
158+
}
159+
150160
const shadowYarnBin = /*@__PURE__*/ require(constants.shadowYarnBinPath)
151161
return await shadowYarnBin(spawnArgs, finalShadowOptions, spawnExtra)
152162
} else {

0 commit comments

Comments
 (0)