Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ func install(version string, cpuarch string) {
// If successful, add npm
status <- Status{Text: "Downloading npm..."}
npmv := getNpmVersion(version)
success := web.GetNpm(root, getNpmVersion(version))
success, npmTempDir := web.GetNpm(root, getNpmVersion(version))
if success {
status <- Status{Text: fmt.Sprintf("Installing npm v%s...", npmv)}

Expand All @@ -750,7 +750,7 @@ func install(version string, cpuarch string) {
defer os.RemoveAll(tempDir)

// Extract npm to the temp directory
err = file.Unzip(filepath.Join(tempDir, "npm-v"+npmv+".zip"), filepath.Join(tempDir, "nvm-npm"))
err = file.Unzip(filepath.Join(npmTempDir, "npm-v"+npmv+".zip"), filepath.Join(tempDir, "nvm-npm"))
if err != nil {
status <- Status{Err: err}
}
Expand Down
6 changes: 3 additions & 3 deletions src/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func GetNodeJS(root string, v string, a string, append bool) bool {

}

func GetNpm(root string, v string) bool {
func GetNpm(root string, v string) (bool, string) {
url := GetFullNpmUrl("v" + v + ".zip")

// temp directory to download the .zip file
Expand All @@ -341,10 +341,10 @@ func GetNpm(root string, v string) bool {
if Download(url, fileName, v) {
utility.DebugLog("npm download succeeded")
fmt.Printf("Complete\n")
return true
return true, tempDir
} else {
utility.DebugLog("npm download failed")
return false
return false, tempDir
}
}

Expand Down