coreybutler/nvm-windows · error
fmt.Sprint(err) + ": " + stderr.String()
Error message
fmt.Sprint(err) + ": " + stderr.String()
What it means
Result of the internal run() helper wrapping every exec.Command failure: it concatenates the Go process error (e.g. 'exit status 1' or 'not found') with the command's captured stderr. It is a generic wrapper, so the underlying failing program and its stderr text are the real diagnostic; in this codebase it surfaces from elevated/child processes invoked during install/use (e.g. elevate.cmd, cmd /C rmdir).
Source
Thrown at src/nvm.go:1897
if err != nil {
exe, _ := os.Executable()
cmd := filepath.Join(filepath.Dir(exe), "elevate.cmd")
ok, err = run(cmd, &env.root, append([]string{"cmd", "/C", name}, arg...)...)
}
return ok, err
}
func run(name string, dir *string, arg ...string) (bool, error) {
c := exec.Command(name, arg...)
if dir != nil {
c.Dir = *dir
}
var stderr bytes.Buffer
c.Stderr = &stderr
err := c.Run()
if err != nil {
return false, errors.New(fmt.Sprint(err) + ": " + stderr.String())
}
return true, nil
}
func runElevated(command string, forceUAC ...bool) (bool, error) {
uac := true //false
if len(forceUAC) > 0 {
uac = forceUAC[0]
}
if uac {
// Alternative elevation option at stackoverflow.com/questions/31558066/how-to-ask-for-administer-privileges-on-windows-with-go
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), command)
var output bytes.Buffer
var _stderr bytes.Buffer
cmd.Stdout = &outputView on GitHub (pinned to 5b18223ca1)
Solutions
- Read the text after the colon — it is the child process's stderr and names the actual failure
- Reproduce the failing child command manually in the same shell to see the full error
- If 'not found'-style: verify the executable exists and PATH/NVM_HOME are correct
- If permission-related: run the nvm command from an elevated terminal
- Temporarily disable overzealous antivirus/EDR interception of child processes and retry
Defensive patterns
Strategy: try-catch
Try / catch
ok, err := run("cmd.exe", nil, "/C", script)
if !ok {
// err already embeds stderr; split for structured handling
if idx := strings.LastIndex(err.Error(), ": "); idx > 0 {
stderr := err.Error()[idx+2:]
log.Printf("child stderr: %s", stderr)
}
} Prevention
- Validate that spawned executables exist and are on PATH before invoking run()
- Capture and log stderr separately for diagnosability
- Test child commands manually before wiring them into nvm flows
When it happens
Trigger: Any child process spawned via run(name, dir, args...) exiting non-zero or failing to start — missing executable (FileNotFound in err), permission denied, or the tool writing an error to stderr and returning a non-zero exit code.
Common situations: PATH missing cmd.exe helpers, antivirus blocking spawned processes, a wrapped batch script failing because of policy or missing files, or elevation helper scripts failing mid-way on locked files.
Related errors
- "%s" is not a valid CPU architecture. Must be 32, 64, or arm
- A version argument is required but missing.
- No versions of node.js found. Try installing the latest by t
- Unrecognized version: "%s"
- Error rolling back node v%s installation: %v.
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/ccfff3266b3205ae.
Report an issue: GitHub.