diff --git a/internal/detector/nodescan.go b/internal/detector/nodescan.go index 783aa56..2c9232b 100644 --- a/internal/detector/nodescan.go +++ b/internal/detector/nodescan.go @@ -339,11 +339,11 @@ 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 != "" { - return filepath.Join(localAppData, "pnpm") + return filepath.Join(localAppData, "pnpm", "bin") } } return "" 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",