From ce66f162b21a4158d2902371ae1524e2dc8a31b5 Mon Sep 17 00:00:00 2001 From: prateek-stepsecurity Date: Wed, 3 Jun 2026 19:00:40 +0530 Subject: [PATCH 1/2] fix: pnpm path fix for windows Signed-off-by: prateek-stepsecurity --- internal/detector/nodescan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/detector/nodescan.go b/internal/detector/nodescan.go index 783aa56..19634ac 100644 --- a/internal/detector/nodescan.go +++ b/internal/detector/nodescan.go @@ -343,7 +343,7 @@ func defaultPnpmBinDir(exec executor.Executor) string { } case model.PlatformWindows: if localAppData := exec.Getenv("LOCALAPPDATA"); localAppData != "" { - return filepath.Join(localAppData, "pnpm") + return filepath.Join(localAppData, "pnpm", "bin") } } return "" From 7baa2cd16f793bb727633f2f58e7d8ae99428dec Mon Sep 17 00:00:00 2001 From: prateek-stepsecurity Date: Thu, 4 Jun 2026 13:43:11 +0530 Subject: [PATCH 2/2] fix: pnpm path fix for linux Signed-off-by: prateek-stepsecurity --- internal/detector/nodescan.go | 2 +- internal/detector/nodescan_test.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/detector/nodescan.go b/internal/detector/nodescan.go index 19634ac..2c9232b 100644 --- a/internal/detector/nodescan.go +++ b/internal/detector/nodescan.go @@ -339,7 +339,7 @@ func defaultPnpmBinDir(exec executor.Executor) string { } case model.PlatformLinux: if home := exec.Getenv("HOME"); home != "" { - return filepath.Join(home, ".local", "share", "pnpm") + return filepath.Join(home, ".local", "share", "pnpm", "bin") } case model.PlatformWindows: if localAppData := exec.Getenv("LOCALAPPDATA"); localAppData != "" { diff --git a/internal/detector/nodescan_test.go b/internal/detector/nodescan_test.go index 1d891b1..94a551b 100644 --- a/internal/detector/nodescan_test.go +++ b/internal/detector/nodescan_test.go @@ -252,9 +252,10 @@ func TestNodeScanner_ScanPnpmGlobal_RootGFallback(t *testing.T) { } } -// TestDefaultPnpmBinDir pins pnpm's per-platform global bin-dir layout. macOS -// uses a /bin subdirectory; Linux and Windows place global binaries directly -// in PNPM_HOME (no /bin). This asymmetry matches pnpm's own `pnpm setup`. +// TestDefaultPnpmBinDir pins pnpm's per-platform global bin-dir layout. +// pnpm v11 places global shims under a /bin subdirectory on macOS, Linux, +// and Windows alike. This matches pnpm's own `pnpm setup` output: the error +// it emits names "/bin" as the dir that must be on PATH. func TestDefaultPnpmBinDir(t *testing.T) { tests := []struct { name string @@ -275,10 +276,10 @@ func TestDefaultPnpmBinDir(t *testing.T) { want: "", }, { - name: "linux with HOME → no bin suffix", + name: "linux with HOME → bin subdir", goos: "linux", envs: map[string]string{"HOME": "/home/foo"}, - want: "/home/foo/.local/share/pnpm", + want: "/home/foo/.local/share/pnpm/bin", }, { name: "linux without HOME → empty",