coreybutler/nvm-windows · error
Could not retrieve %v: %v
Error message
Could not retrieve %v: %v
What it means
GetRemoteTextFile(url) performs an HTTP GET using nvm-windows' shared web client. This error means the request itself failed before any response arrived — DNS resolution failure, TCP connection refused/timeout, TLS handshake error, or proxy misconfiguration. The wrapped error (and URL) in the message identify which link failed.
Source
Thrown at src/web/web.go:354
}
}
fileName := tempDir + "\\" + "npm-v" + v + ".zip"
fmt.Printf("Downloading npm version " + v + "... ")
if Download(url, fileName, v) {
utility.DebugLog("npm download succeeded")
fmt.Printf("Complete\n")
return true
} else {
utility.DebugLog("npm download failed")
return false
}
}
func GetRemoteTextFile(url string) (string, error) {
response, httperr := client.Get(url)
if httperr != nil {
return "", fmt.Errorf("Could not retrieve %v: %v", url, httperr)
}
if response.StatusCode != 200 {
return "", fmt.Errorf("Error retrieving \"%s\": HTTP Status %v\n", url, response.StatusCode)
}
defer response.Body.Close()
contents, readerr := ioutil.ReadAll(response.Body)
if readerr != nil {
return "", fmt.Errorf("error reading HTTP request body: %v", readerr)
}
return string(contents), nil
}
func IsNode64bitAvailable(v string) bool {
if v == "latest" {View on GitHub (pinned to 5b18223ca1)
Solutions
- Check the wrapped error: 'dial tcp: lookup ... no such host' means DNS — fix connectivity or the mirror URL.
- If behind a corporate proxy, configure it: nvm proxy <http://user:pass@host:port>.
- If TLS errors appear, verify the mirror URL uses a valid certificate, or (with understood risk) 'nvm off' verifyssl equivalent — set ssl_verify off in settings.txt only if your network intercepts TLS.
- Switch to a reachable mirror: set NVM_NODE_MIRROR / use nvm's mirror commands (e.g. https://npmmirror.com/mirrors/node).
Example fix
// before
response, httperr := client.Get(url)
if httperr != nil {
return "", fmt.Errorf("Could not retrieve %v: %v", url, httperr)
}
// after: include operation hints in the message
response, httperr := client.Get(url)
if httperr != nil {
return "", fmt.Errorf("could not retrieve %v (check network/proxy/mirror settings): %w", url, httperr)
} Defensive patterns
Strategy: retry
Validate before calling
// Validate connectivity/URL before calling GetRemoteTextFile
u, err := url.Parse(mirrorURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") { return errors.New("bad mirror URL") }
conn, err := net.DialTimeout("tcp", net.JoinHostPort(u.Hostname(), port(u)), 5*time.Second)
if err != nil { return fmt.Errorf("mirror unreachable: %w", err) }
conn.Close() Try / catch
var body string
var err error
for i := 0; i < 3; i++ {
body, err = web.GetRemoteTextFile(url)
if err == nil { break }
if !strings.Contains(err.Error(), "Could not retrieve") { break } // only retry transport errors
time.Sleep(time.Duration(i+1) * time.Second)
} Prevention
- Configure 'nvm proxy' on corporate networks.
- Keep NVM_NODE_MIRROR/NVM_NPM_MIRROR pointed at reachable mirrors.
- Test the mirror with curl before blaming nvm.
When it happens
Trigger: GetRemoteTextFile hitting node/npm mirror index files (e.g. https://nodejs.org/dist/index.json or a configured mirror) when the machine is offline, the mirror domain is blocked/unreachable, a corporate proxy is required but not set (nvm proxy setting), or verifyssl rejects a self-signed TLS intercept.
Common situations: Users in regions where nodejs.org is slow/blocked setting NVM_NODE_MIRROR to taobao/npmmirror; corporate TLS-intercepting proxies without setting 'nvm proxy'; DNS or VPN outages; typo'd mirror URL from 'nvm node_mirror'.
Related errors
- Error retrieving "%s": HTTP Status %v
- error: failed to obtain update data: %v
- error: received status code %d
- error reading HTTP request body: %v
- failed to download v%v arm 64-bit executable
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/186aa2bd1fb4e6f9.
Report an issue: GitHub.