parcel-bundler/parcel · error · ThrowableDiagnostic
Could not determine version of ${pluginName} in ${path.relat
Error message
Could not determine version of ${pluginName} in ${path.relative(process.cwd(), resolveFrom)}. Either include it in "dependencies" or "parcelDependencies". What it means
When Parcel auto-installs a plugin referenced by a config package, it needs a version range. It looks up the plugin name in the config package's `dependencies` and `parcelDependencies` (and `optionalParcelDependencies`). If none of these provide a range and the plugin isn't optional, Parcel cannot decide which version to install and reports the config file as the source.
Source
Thrown at packages/core/core/src/loadParcelPlugin.js:92
options.projectRoot,
);
if (
configPkg != null &&
configPkg.config.dependencies?.[pluginName] == null
) {
// If not in the config's dependencies, the plugin will be auto installed with
// the version declared in "parcelDependencies".
range = configPkg.config.parcelDependencies?.[pluginName];
isOptional =
Array.isArray(configPkg.config.optionalParcelDependencies) &&
configPkg.config.optionalParcelDependencies.includes(pluginName);
if (range == null && !isOptional) {
let contents = await options.inputFS.readFile(
configPkg.files[0].filePath,
'utf8',
);
throw new ThrowableDiagnostic({
diagnostic: {
message: md`Could not determine version of ${pluginName} in ${path.relative(
process.cwd(),
resolveFrom,
)}. Either include it in "dependencies" or "parcelDependencies".`,
origin: '@parcel/core',
codeFrames:
configPkg.config.dependencies ||
configPkg.config.parcelDependencies
? [
{
filePath: configPkg.files[0].filePath,
language: 'json5',
code: contents,
codeHighlights: generateJSONCodeHighlights(contents, [
{
key: configPkg.config.parcelDependencies
? '/parcelDependencies'View on GitHub (pinned to 59484858a1)
Solutions
- Add the plugin to `parcelDependencies` (recommended for config packages) with a semver range.
- Or add it to `dependencies` so it ships with the config package.
- Re-run the build after editing package.json so the version is resolved.
Example fix
// before (config package package.json)
{ "dependencies": {} }
// after
{ "parcelDependencies": { "@parcel/transformer-image": "^2.0.0" } } Defensive patterns
Strategy: validation
Validate before calling
// Validate that every plugin referenced by the config is declared.
const declared = new Set([
...Object.keys(pkg.dependencies ?? {}),
...Object.keys(pkg.parcelDependencies ?? {}),
]);
for (const p of referencedPlugins) {
if (!declared.has(p)) throw new Error(`declare ${p} in parcelDependencies`);
} Type guard
function isDeclaredPlugin(name: string, pkg: any): boolean {
return Boolean(
pkg.dependencies?.[name] ?? pkg.parcelDependencies?.[name],
);
} Prevention
- Add every plugin to parcelDependencies when authoring a config package.
- Run a config-lint step in CI that cross-checks .parcelrc vs package.json.
When it happens
Trigger: A config package references a plugin by name but its `package.json` omits that plugin from both `dependencies` and `parcelDependencies`.
Common situations: Authoring a config package and forgetting to declare the plugin dependency; adding a pipeline entry without updating package.json.
Related errors
- Local plugins are not supported in Parcel config packages. P
- The plugin "${pluginName}" is not compatible with the curren
- Config result is not hashable because it contains non-serial
- Bundle is not inline and unable to retrieve contents
- Only one spread parameter can be included in a config pipeli
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/ac312f6bb2acbfae.
Report an issue: GitHub.