lerna/lerna · error · ValidationError
ENOPKG
ENOPKG
Error message
Cannot diff, the package '${packageName}' does not exist. What it means
Error "Cannot diff, the package '${packageName}' does not exist." thrown in lerna/lerna.
Source
Thrown at libs/commands/diff/src/index.ts:30
pkgName?: string;
ignoreChanges?: string[];
}
export class DiffCommand extends Command<DiffCommandOptions> {
private args: string[] = [];
override initialize() {
const packageName = this.options.pkgName;
let targetPackage;
if (packageName) {
const project = Object.values(this.projectGraph.nodes).find(
(p) => p.package && getPackage(p).name === packageName
);
targetPackage = project && getPackage(project);
if (!targetPackage) {
throw new ValidationError("ENOPKG", `Cannot diff, the package '${packageName}' does not exist.`);
}
}
if (!hasCommit(this.execOpts)) {
throw new ValidationError("ENOCOMMITS", "Cannot diff, there are no commits in this repository yet.");
}
const args = ["diff", getLastCommit(this.execOpts), "--color=auto"];
if (targetPackage) {
args.push("--", targetPackage.location);
} else {
args.push("--", ...this.project.packageParentDirs);
}
if (this.options.ignoreChanges) {
this.options.ignoreChanges.forEach((ignorePattern) => {
// https://stackoverflow.com/a/21079437View on GitHub (pinned to 35d15a1567)
When it happens
Trigger: Thrown at libs/commands/diff/src/index.ts:30 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of lerna/lerna@35d15a1567 (2026-08-27).
Data as JSON: /api/errors/ed48864f2f6a1eb8.
Report an issue: GitHub.