n8n-io/n8n · error · Error
nodes.json not found at ${nodesJsonPath}
Error message
nodes.json not found at ${nodesJsonPath} What it means
generateNodeDefinitions() is the post-build CLI that turns a package's dist/types/nodes.json into node definitions. Its first action is fs.existsSync(nodesJsonPath); if the file is missing it throws immediately with the resolved path so you know exactly what it looked for.
Source
Thrown at packages/@n8n/workflow-sdk/src/generate-types/generate-node-defs-cli.ts:65
const pkg = JSON.parse(fs.readFileSync(sdkPackageJsonPath, 'utf-8')) as { version: string };
return pkg.version;
} catch {
return 'unknown';
}
}
/**
* Generate node definitions from a nodes.json file.
* Skips generation if the input hash matches the stored sentinel.
* Testable core logic extracted from CLI entry point.
*/
export async function generateNodeDefinitions(
options: GenerateNodeDefinitionsOptions,
): Promise<void> {
const { nodesJsonPath, outputDir, packageName } = options;
if (!fs.existsSync(nodesJsonPath)) {
throw new Error(`nodes.json not found at ${nodesJsonPath}`);
}
const content = await fs.promises.readFile(nodesJsonPath, 'utf-8');
// Hash-based skip: check if output is already up to date
const sdkVersion = getSdkVersion();
const inputHash = computeInputHash(content, sdkVersion);
const hashFilePath = path.join(outputDir, HASH_SENTINEL_FILE);
try {
const existingHash = await fs.promises.readFile(hashFilePath, 'utf-8');
if (existingHash.trim() === inputHash) {
console.log('Node definitions up to date (hash match), skipping generation.');
return;
}
} catch {
// Hash file doesn't exist — proceed with generation
}View on GitHub (pinned to 5ac6606e81)
Solutions
- Run the package build first (e.g. pnpm build for the node package) so dist/types/nodes.json exists.
- Invoke the CLI from the package root, or pass an explicit absolute nodesJsonPath.
- Check the printed path with ls to confirm where nodes.json actually is and adjust the option.
Defensive patterns
Strategy: validation
Validate before calling
import * as fs from 'fs';
if (!fs.existsSync(nodesJsonPath)) {
throw new Error(`Build dist/types/nodes.json is missing at ${nodesJsonPath}. Run the package build first.`);
}
await generateNodeDefinitions({ nodesJsonPath, outputDir, packageName }); Prevention
- Run the package build before invoking n8n-generate-node-defs.
- Invoke the CLI from the package root, or pass an absolute nodesJsonPath.
- In CI, assert dist/types/nodes.json exists immediately after the build step.
When it happens
Trigger: Running n8n-generate-node-defs before the package build has emitted dist/types/nodes.json; running it from the wrong working directory; passing a custom nodesJsonPath option that points nowhere; build failed silently so nodes.json was never written.
Common situations: Fresh checkout where build was skipped; CI running the generate step out of order; custom packaging scripts that override nodesJsonPath; monorepo where the CLI is invoked from the repo root instead of the package dir.
Related errors
- Failed to parse node types from ${jsonPath}: ${error instanc
- Workflow directory not found: ${workflowDir}
- --build-cwd directory does not exist: ${args.buildCwd}
- Disk source needs the n8n repo (run from inside it) or --wor
- ${claudeConfigPath} not found
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/c75cacb65c2b5144.
Report an issue: GitHub.