parcel-bundler/parcel · error · ThrowableDiagnostic
Could not find entry: ${entry}
Error message
Could not find entry: ${entry} What it means
Thrown by resolveEntry() when the entry is a directory, a package.json was successfully read, but no valid entries were found — meaning package.json has no source field and no targets with source fields that resolve to existing files. The code falls through past the entries.length && files.length check.
Source
Thrown at packages/core/core/src/requests/EntryRequest.js:318
...getJSONSourceLocation(pkg.map.pointers[keyPath], 'value'),
},
});
}
i++;
}
}
// Only return if we found any valid entries
if (entries.length && files.length) {
return {
entries,
files,
globs,
};
}
}
throw new ThrowableDiagnostic({
diagnostic: {
message: md`Could not find entry: ${entry}`,
},
});
} else if (stat.isFile()) {
let projectRoot = this.options.projectRoot;
let packagePath = isDirectoryInside(
this.options.inputFS.cwd(),
projectRoot,
)
? this.options.inputFS.cwd()
: projectRoot;
return {
entries: [
{
filePath: toProjectPath(this.options.projectRoot, entry),
packagePath: toProjectPath(this.options.projectRoot, packagePath),View on GitHub (pinned to 59484858a1)
Solutions
- Add a "source" field to the directory's package.json pointing at your entry file.
- Or add a "targets" section with at least one target that has a "source" field.
- Verify the source value is non-empty and matches an existing file.
- If using globs in source, confirm the glob pattern actually matches files in the directory.
Example fix
// before — package.json (no source)
{
"name": "my-app",
"version": "1.0.0"
}
// after
{
"name": "my-app",
"version": "1.0.0",
"source": "src/index.html"
} Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const path = require('path');
function validateDirectoryEntryHasSource(dir) {
const pkgFile = path.join(dir, 'package.json');
if (!fs.existsSync(pkgFile)) return; // different error path
const pkg = JSON.parse(fs.readFileSync(pkgFile, 'utf8'));
const hasSource = pkg.source != null;
const hasTargetSource = pkg.targets && Object.values(pkg.targets).some(t => t.source != null);
if (!hasSource && !hasTargetSource) {
throw new Error(`Directory ${dir} has package.json but no "source" field or targets with source.`);
}
} Prevention
- Always include a source field in package.json for projects used as Parcel entries.
- In monorepos, ensure each app package has its own source field.
- Validate package.json structure in a prebuild CI step.
When it happens
Trigger: Entered when stat says the entry is a directory, readPackage() returns a parsed package.json, but the loop over pkg.source and pkg.targets[*].source produces zero entries (fields absent, empty, or all globs matching nothing). The final guard if (entries.length && files.length) is false.
Common situations: Pointing Parcel at a directory whose package.json lacks a source field and has no targets; package.json source field is an empty string or array; all target sources are globs that match zero files; package.json was auto-generated (e.g., by npm init) without a source.
Related errors
- ${path.relative(process.cwd(), source)} does not exist.
- ${path.relative(process.cwd(), source)} is not a file.
- Entry ${entry} does not exist
- Error parsing ${path.relative(this.options.inputFS.cwd(), pk
- Could not find target with name "${target}"
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/69ca2f283743999a.
Report an issue: GitHub.