Skip to content

Commit 4317fef

Browse files
authored
fix: use globbySync to resolve PNPM global node_modules paths (#692)
* fix: use globbySync to resolve PNPM global node_modules paths * remove unnecessary pnpmHome from resolve
1 parent c8bc53a commit 4317fef

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/module-lookup.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,15 @@ function getGlobalNpmPaths(filterPaths = true): string[] {
271271
}
272272

273273
if (process.env.PNPM_HOME) {
274-
paths.push(resolve(process.env.PNPM_HOME, 'global/*/node_modules'));
274+
const pnpmHome = process.env.PNPM_HOME;
275+
paths.push(
276+
...globbySync('global/*/node_modules', {
277+
cwd: pnpmHome,
278+
onlyDirectories: true,
279+
suppressErrors: true,
280+
absolute: true,
281+
}).map(modulesPath => resolve(modulesPath)),
282+
);
275283
}
276284

277285
// Get npm global prefix and infer the module paths from there

0 commit comments

Comments
 (0)