{"record":{"id":"af0d73c6602a0978","repo":"withastro/astro","slug":"unable-to-fetch-integration-does-the-package-e","errorCode":null,"errorMessage":"Unable to fetch ${integration}. Does the package exist?","messagePattern":"Unable to fetch (.+?)\\. Does the package exist\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/cli/add/index.ts","lineNumber":892,"sourceCode":"\t\t\t\t\t\t\t\t`No problem! Find our official integrations at ${cyan(\n\t\t\t\t\t\t\t\t\t'https://astro.build/integrations',\n\t\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tspinner.message('Resolving with third party packages...');\n\t\t\t\t\t\tpkgType = 'third-party';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpkgType = 'first-party';\n\t\t\t\t\t\tpkgJson = firstPartyPkgCheck as any;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pkgType === 'third-party') {\n\t\t\t\t\tconst thirdPartyPkgCheck = await fetchPackageJson(scope, name, tag);\n\t\t\t\t\tif (thirdPartyPkgCheck instanceof Error) {\n\t\t\t\t\t\tif (thirdPartyPkgCheck.message) {\n\t\t\t\t\t\t\tspinner.message(yellow(thirdPartyPkgCheck.message));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new Error(`Unable to fetch ${bold(integration)}. Does the package exist?`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpkgJson = thirdPartyPkgCheck as any;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst resolvedScope = pkgType === 'first-party' ? '@astrojs' : scope;\n\t\t\t\tconst packageName = `${resolvedScope ? `${resolvedScope}/` : ''}${name}`;\n\t\t\t\tlet integrationName = packageName;\n\t\t\t\tlet dependencies: IntegrationInfo['dependencies'] = [\n\t\t\t\t\t[pkgJson['name'], `^${pkgJson['version']}`],\n\t\t\t\t];\n\n\t\t\t\tif (pkgJson['peerDependencies']) {\n\t\t\t\t\tconst meta = pkgJson['peerDependenciesMeta'] || {};\n\t\t\t\t\tfor (const peer in pkgJson['peerDependencies']) {\n\t\t\t\t\t\tconst optional = meta[peer]?.optional || false;\n\t\t\t\t\t\tconst isAstro = peer === 'astro';\n\t\t\t\t\t\tif (!optional && !isAstro) {","sourceCodeStart":874,"sourceCodeEnd":910,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/astro/src/cli/add/index.ts#L874-L910","documentation":"Thrown by `astro add` when a third-party package cannot be fetched from the npm registry. After determining the target is third-party (explicit non-@astrojs scope, or the user accepted the fallback), Astro calls fetchPackageJson(scope, name, tag); any Error result — a non-2xx registry response such as 404, or a failed fetch — aborts the add, because Astro needs the package.json to build the install plan.","triggerScenarios":"`astro add @scope/name` where `${registry}/@scope/name/<tag>` returns 404/5xx or the network request fails; also `astro add pkg@sometag` with a dist-tag that does not exist.","commonSituations":"Typo in scope or package name, package unpublished or made private, corporate registry mirror that has not synced the package, offline machine or HTTP proxy blocking registry traffic, wrong dist-tag.","solutions":["Verify the package exists and is reachable: `npm view @scope/name version` (use the same package manager you build with)","Fix the name, scope, or tag and re-run `astro add @scope/name@latest`","Check your registry configuration (`npm config get registry`, or the pnpm/yarn equivalent) and point it at a registry that serves the package","If offline or behind a proxy, configure HTTPS_PROXY / corporate registry before retrying"],"exampleFix":"# before\nastro add @my-org/astro-thing   # Unable to fetch @my-org/astro-thing. Does the package exist?\n\n# after\nnpm view @my-org/astro-thing version   # confirm name/tag resolve on your registry\nastro add @my-org/astro-thing@latest","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\n\n// resolve the exact spec against the same registry astro will use\nfunction packageIsFetchable(spec) {\n  try {\n    execSync(`npm view ${spec} version`, { stdio: ['pipe', 'pipe', 'ignore'] });\n    return true;\n  } catch {\n    return false;\n  }\n}\n\nif (!packageIsFetchable('@my-org/astro-thing@latest')) {\n  // fix name/tag or registry before running astro add\n}","typeGuard":null,"tryCatchPattern":"import { spawnSync } from 'node:child_process';\nconst r = spawnSync('astro', ['add', spec], { encoding: 'utf8' });\nif (r.status !== 0 && /Does the package exist\\?/.test(r.stderr)) {\n  // name/tag/registry problem — verify spec with `npm view` and retry once corrected\n}","preventionTips":["Pin full specs (scope + name + tag) in scripts so typos surface as visible config, not runtime failures","In CI or air-gapped environments, pre-check registry reachability before any astro add step","Make private packages accessible on your registry (publish or proxy) before referencing them with astro add"],"tags":["cli","astro-add","network","package-registry","integrations"],"backgroundTag":"package-not-found-in-registry","analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}