parcel-bundler/parcel · error · Error
npmResolve failed: fetching ${name} - ${res.status}
Error message
npmResolve failed: fetching ${name} - ${res.status} What it means
Thrown by `SimplePackageInstaller._npmResolve` in the Parcel REPL when the HTTP GET to `https://registry.npmjs.org/<name>` returns a non-2xx response. It is a hard network failure: the registry either did not have the package, refused the request, or was unreachable. The status code is appended so you can tell which.
Source
Thrown at packages/dev/repl/SimplePackageInstaller/index.js:69
}
// https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md
// https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md
async _npmResolve(name: string, version: string): Promise<ResolveCacheEntry> {
// reuse newest compatible version in cache if possible?
const cacheEntry = this.cache.resolve.get(`${name}@${version}`);
if (cacheEntry) {
return cacheEntry;
}
const res = await fetch(`https://registry.npmjs.org/${name}`, {
headers: {
Accept: 'application/vnd.npm.install-v1+json',
Origin: 'repl.parceljs.org',
},
});
if (!res.ok) {
throw new Error(`npmResolve failed: fetching ${name} - ${res.status}`);
}
const data: {|
name: string,
modified: string,
'dist-tags': {|[string]: string|},
versions: {|[string]: ResolveCacheEntry|},
|} = await res.json();
let resolvedVersion;
if (version in data['dist-tags']) {
resolvedVersion = data['dist-tags'][version];
} else if (semver.validRange(version)) {
// $FlowFixMe
resolvedVersion = (semver.maxSatisfying(
Object.keys(data.versions),
version,
): string);
if (!resolvedVersion) {View on GitHub (pinned to 59484858a1)
Solutions
- Check the status code: 404 → fix/confirm the package name; 429 → wait and retry; 5xx → retry shortly / check npm status page.
- Verify the package exists: open https://www.npmjs.com/package/<name> or `npm view <name>`.
- Ensure network/registry access from the REPL environment (CORS from `repl.parceljs.org` origin is expected).
- For scoped/private packages, note that the REPL only supports the public npm registry — use a public package.
Example fix
// before
installer._npmResolve('reactt', 'latest') // 404
// after
installer._npmResolve('react', 'latest') Defensive patterns
Strategy: retry
Validate before calling
async function registryReachable(name) {
const r = await fetch(`https://registry.npmjs.org/${name}`, {
headers: { Accept: 'application/vnd.npm.install-v1+json' }
});
return r.ok;
} Try / catch
try { await installer._npmResolve(name, ver); }
catch (e) {
if (/npmResolve failed: fetching .* - (429|5\d\d)/.test(e.message)) { /* retry w/ backoff */ }
else if (/ - 404/.test(e.message)) { /* name wrong / unpublished */ }
else throw e;
} Prevention
- Validate package names before submitting (npm view).
- Retry 429/5xx with exponential backoff.
- Surface the status code to the user instead of a generic failure.
When it happens
Trigger: REPL user adds a dependency whose name is misspelled or unpublished (404); registry is rate-limiting the `repl.parceljs.org` origin (429); registry downtime or CORS/network block (5xx, 0); private/scoped package not on the public registry.
Common situations: Typo in a package name; package was unpublished or renamed; corporate proxy/firewall blocks registry.npmjs.org; offline; very new package not yet replicated; scoped package requiring auth.
Related errors
- npmFetch failed: fetching ${tarball} - ${res.status}
- npm failed to install modules: ${e.message} - ${stderr.join(
- npmResolve failed: resolving ${name}@${version}
- ${name}@${version}: only npm semver dependencies are current
- Cannot find extended parcel config
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/6077f69014a303a5.
Report an issue: GitHub.