Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/npm/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package npm

import (
"fmt"
"os"
"path/filepath"

"github.com/SAP/jenkins-library/pkg/log"
Expand Down Expand Up @@ -52,6 +53,13 @@ func (pm *PackageManager) InstallPnpm(execRunner ExecRunner, pnpmVersion string,
if err := execRunner.RunExecutable("npm", "install", pnpmPackage, "--prefix", prefixPath); err != nil {
return fmt.Errorf("failed to install pnpm locally: %w", err)
}

// Add the local pnpm bin directory to PATH so it's globally available
pnpmBinDir := filepath.Join(prefixPath, "node_modules", ".bin")
currentPath := os.Getenv("PATH")
newPath := pnpmBinDir + string(os.PathListSeparator) + currentPath
os.Setenv("PATH", newPath)

return nil
}

Expand Down
Loading