Skip to content

Commit

Permalink
fix: correct command execution method in get global bin path
Browse files Browse the repository at this point in the history
  • Loading branch information
JaleelB committed May 19, 2024
1 parent cb32661 commit 5745e8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
)

func GetGlobalBinPath() (string, error) {
npmVersion, err := ExecuteGitCommand("npm", "-v")
npmVersion, err := ExecuteCommand("npm", "-v")
if err != nil {
return "", fmt.Errorf("failed to check npm version: %w", err)
}
globalBinPath := ""

if compareVersions(npmVersion, "8.19.4") <= 0 {
globalBinPath, err = ExecuteGitCommand("npm", "bin", "-g")
globalBinPath, err = ExecuteCommand("npm", "bin", "-g")
if err != nil {
return "", fmt.Errorf("failed to get global bin path using 'npm bin -g': %w", err)
}
} else {
prefix, err := ExecuteGitCommand("npm", "config", "--global", "get", "prefix")
prefix, err := ExecuteCommand("npm", "config", "--global", "get", "prefix")
if err != nil {
return "", fmt.Errorf("failed to get npm global prefix: %w", err)
}
Expand Down

0 comments on commit 5745e8f

Please sign in to comment.