From 9a2b0e65f7db84e1fdd6d90203fb80802f58813d 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 fc28cc3..9790ff0 100644 --- a/internal/detector/nodescan.go +++ b/internal/detector/nodescan.go @@ -376,7 +376,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 1f50488e6d6dc6d935538086bdfd27476a3d2c73 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 9790ff0..a5a3b59 100644 --- a/internal/detector/nodescan.go +++ b/internal/detector/nodescan.go @@ -372,7 +372,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 a1802a6..daffcb5 100644 --- a/internal/detector/nodescan_test.go +++ b/internal/detector/nodescan_test.go @@ -254,9 +254,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 @@ -277,10 +278,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",