{"record":{"id":"e5c6f90ec2349ba4","repo":"coreybutler/nvm-windows","slug":"failed-to-extract-npm-v","errorCode":null,"errorMessage":"Failed to extract npm: %v","messagePattern":"Failed to extract npm: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/nvm.go","lineNumber":812,"sourceCode":"\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif err == nil && moveNpmErr == nil {\n\t\t\t\t\terr = utility.Rename(filepath.Join(root, \"v\"+version), filepath.Join(env.root, \"v\"+version))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tstatus <- Status{Err: err}\n\t\t\t\t\t}\n\t\t\t\t\tif show_progress {\n\t\t\t\t\t\tstatus <- Status{Done: true}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatus <- Status{Text: fmt.Sprintf(\"Installation complete. If you want to use this version, type\\n\\nnvm use %s\", version), Done: true}\n\t\t\t\t\t}\n\t\t\t\t} else if moveNpmErr != nil {\n\t\t\t\t\tstatus <- Status{Err: fmt.Errorf(\"Unable to move directory %s to node_modules: %v\", npmSourcePath, moveNpmErr), Done: true}\n\t\t\t\t} else {\n\t\t\t\t\tstatus <- Status{Err: fmt.Errorf(\"Failed to extract npm: %v\", err), Done: true}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = utility.Rename(filepath.Join(root, \"v\"+version), filepath.Join(env.root, \"v\"+version))\n\t\t\t\tif err != nil {\n\t\t\t\t\tstatus <- Status{Err: err}\n\t\t\t\t}\n\n\t\t\t\tnpmurl := web.GetFullNpmUrl(version)\n\t\t\t\tif show_progress {\n\t\t\t\t\t// Send special error notification with link to npm release when it cannot be downloaded\n\t\t\t\t\tnotify(Notification{\n\t\t\t\t\t\tTitle:   \"Download Failure (npm)\",\n\t\t\t\t\t\tMessage: fmt.Sprintf(\"Please download npm v%s manually and extract to %s\\\\v%s\", version, env.root, version),\n\t\t\t\t\t\tIcon:    \"error\",\n\t\t\t\t\t\tActions: []Action{\n\t\t\t\t\t\t\t{Type: \"protocol\", Label: \"Manually Download\", URI: npmurl},\n\t\t\t\t\t\t},\n\t\t\t\t\t})","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/nvm.go#L794-L830","documentation":"Sent (Done: true) on the else-branch where moveNpmErr is nil but the npm extraction step returned err != nil — the npm archive download/unzip itself failed before any move was attempted. Node.exe is installed at this point, but npm is not.","triggerScenarios":"`nvm install <version>` where fetching or unzipping the npm tarball from web.GetFullNpmUrl(version) fails: npm mirror unreachable, HTTP error returned, archive truncated, or extraction hit disk-full/permission problems.","commonSituations":"Custom npm_mirror pointing to a stale or incomplete mirror; npm.github.io/cli archive access blocked by firewall; %TEMP% full; proxy misconfigured so only the node zip succeeded (cached) while npm fetch failed.","solutions":["Retry; if persistent, reset the npm mirror: `nvm npm_mirror <official-url>`.","Verify network/proxy (`nvm proxy`) and that the printed npm URL is reachable from the machine.","Free %TEMP% space and clear nvm-npm temp dirs.","Finish manually: download the npm archive named in the follow-up message, extract it under <NVM_ROOT>\\v<version> as instructed, or `nvm uninstall` + reinstall cleanly."],"exampleFix":"# before\nnvm install 20.11.0   # npm download fails\n# after\nnvm npm_mirror https://github.com/npm/cli/archive\nnvm install 20.11.0","handlingStrategy":"retry","validationCode":"# bash: pre-flight the npm archive URL\ncurl -sfI \"$NPM_URL\" >/dev/null || { echo \"npm archive unreachable: $NPM_URL\" >&2; exit 1; }\nnvm install \"$V\"","typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do nvm install \"$V\" && exit 0; sleep $((i*5)); done; echo 'npm fetch kept failing — check npm_mirror/proxy' >&2; exit 1","preventionTips":["Validate `nvm npm_mirror` points at a complete npm archive.","Ensure proxies are configured via `nvm proxy` before headless installs.","Clear nvm-npm temp dirs between retries."],"tags":["nvm-windows","npm","network","extraction","install"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}