parcel-bundler/parcel · error · Error
${name}@${version}: only npm semver dependencies are current
Error message
${name}@${version}: only npm semver dependencies are currently supported. What it means
Thrown by `SimplePackageInstaller._npmResolve` when the version string is neither a key in the registry's `dist-tags` nor a valid npm semver range. The REPL installer intentionally rejects non-npm specifiers because it only knows how to fetch from the public npm registry.
Source
Thrown at packages/dev/repl/SimplePackageInstaller/index.js:91
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) {
throw new Error(`npmResolve failed: resolving ${name}@${version}`);
}
} else {
throw new Error(
`${name}@${version}: only npm semver dependencies are currently supported.`,
);
}
this.cache.resolve.set(
`${name}@${version}`,
data.versions[resolvedVersion],
);
return data.versions[resolvedVersion];
}
async _npmFetch(tarball: string): Promise<Map<string, Uint8Array>> {
const cacheEntry = this.cache.fetch.get(tarball);
if (cacheEntry) {
return cacheEntry;
}
const res = await fetch(tarball);
if (!res.ok) {View on GitHub (pinned to 59484858a1)
Solutions
- Replace the specifier with a concrete version or semver range that exists on the public registry.
- For aliased packages (`npm:foo@^1.2.3`), unwrap to the real package name and version.
- For workspace/link deps, the REPL cannot install them — substitute the published npm version.
- Validate the string with `semver.validRange(spec)` before submitting.
Example fix
// before
installer._npmResolve('mylib', 'file:../mylib')
// after
installer._npmResolve('mylib', '^1.2.0') Defensive patterns
Strategy: validation
Validate before calling
const semver = require('semver');
function isReplSupportedSpec(version, distTags = ['latest']) {
return distTags.includes(version) || !!semver.validRange(version);
} Type guard
function isNpmSemverSpec(spec) {
return typeof spec === 'string' && !/^(file|link|git|workspace|npm):/.test(spec) && !!semver.validRange(spec);
} Prevention
- Reject git/file/link/workspace specs before submitting to the REPL installer.
- Validate with `semver.validRange` on user input.
- Unwrap `npm:` aliases client-side.
When it happens
Trigger: Specifier uses a git URL (`git+https://...`), GitHub shorthand (`user/repo`), local file (`file:../pkg`), link (`link:../pkg`), or an `npm:` alias; specifier is malformed and fails `semver.validRange`.
Common situations: Copying a dependency from a monorepo `package.json` that uses `workspace:*` or `link:`; pasting a git URL; typos in a version string that make it non-semver.
Related errors
- npmResolve failed: resolving ${name}@${version}
- Could not find module "${name}" satisfying ${range}.
- npmResolve failed: fetching ${name} - ${res.status}
- npmFetch failed: fetching ${tarball} - ${res.status}
- The plugin "${pluginName}" is not compatible with the curren
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/7386712b69f1945e.
Report an issue: GitHub.