{"record":{"id":"b32f55d6ff488be3","repo":"withastro/astro","slug":"unable-to-fetch-latest-packagename-version-from","errorCode":null,"errorMessage":"Unable to fetch latest ${packageName} version from the npm registry. Using ${fallbackName} instead.","messagePattern":"Unable to fetch latest (.+?) version from the npm registry\\. Using (.+?) instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/create-astro/src/messages.ts","lineNumber":69,"sourceCode":"\t\t});\n\t});\n\nexport const getVersion = (\n\tpackageManager: string,\n\tpackageName: string,\n\tpackageTag = 'latest',\n\tfallback = '',\n) =>\n\tnew Promise<string>(async (resolve) => {\n\t\tlet registry = await getRegistry(packageManager);\n\t\tconst { version } = await fetch(`${registry}/${packageName}/${packageTag}`, {\n\t\t\tredirect: 'follow',\n\t\t\tsignal: AbortSignal.timeout(10_000),\n\t\t})\n\t\t\t.then((res) => res.json())\n\t\t\t.catch(() => {\n\t\t\t\tconst fallbackName = fallback || `'latest'`;\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Unable to fetch latest ${packageName} version from the npm registry. Using ${fallbackName} instead.`,\n\t\t\t\t);\n\t\t\t\treturn { version: fallback };\n\t\t\t});\n\t\treturn resolve(version);\n\t});\n\nexport const log = (message: string) => stdout.write(message + '\\n');\nexport const banner = () => {\n\tconst prefix = `astro`;\n\tconst suffix = `Launch sequence initiated.`;\n\tlog(`${label(prefix, color.bgGreen, color.black)}  ${suffix}`);\n};\n\nexport const bannerAbort = () =>\n\tlog(`\\n${label('astro', color.bgRed)} ${color.bold('Launch sequence aborted.')}`);\n\nexport const info = async (prefix: string, text: string) => {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/create-astro/src/messages.ts#L51-L87","documentation":"create-astro resolves which template/package version to use by fetching `${registry}/${packageName}/${tag}` (default tag 'latest') with a 10-second AbortSignal timeout. If the fetch or JSON parse fails, the .catch handler logs this warning and resolves with the fallback (or the literal 'latest') — scaffolding continues, just with the fallback version choice.","triggerScenarios":"Running `npm create astro` (or create-astro directly) with no network egress to the registry; a custom registry that is down or returns non-JSON (HTML error pages); proxies blocking registry.npmjs.org; slow networks exceeding the 10s timeout.","commonSituations":"CI runners with restricted egress; offline onboarding; corporate Artifactory/Nexus mirrors misconfigured in .npmrc; npm outages; the warning is benign but signals the chosen version may not be what you expected.","solutions":["Pass an explicit --template so the version choice does not depend on the registry lookup","Fix registry connectivity: check `npm config get registry`, proxy env vars (HTTPS_PROXY/HTTP_PROXY), and run `npm ping`","Retry once the network or registry recovers — the tool already fell back safely, so nothing is half-installed","Pin a specific tag/version in your scaffolding docs so the fallback path is the expected path"],"exampleFix":"# before (relies on the 'latest' registry lookup)\nnpm create astro@latest my-app\n\n# after (explicit template; lookup failure no longer changes the outcome)\nnpm create astro@latest my-app -- --template basics","handlingStrategy":"retry","validationCode":"# Verify registry reachability before scaffolding\nnpm ping && npm config get registry","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `npm ping` / `npm view astro version` before scaffolding on restricted networks","Configure HTTPS_PROXY and registry in .npmrc for corporate environments","Pass --template explicitly so the registry lookup cannot change the outcome","Treat the warning as non-fatal: the tool already fell back to a usable version"],"tags":["create-astro","npm","registry","network","timeout"],"backgroundTag":"package-registry-fetch-failed","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}