cube-js/cube · error · UserError
'${fileName}' transpiling failed
Error message
'${fileName}' transpiling failed What it means
readModuleFile transpiles the resolved module file via transpileFile; if the transpiler returns falsy (compilation produced no output, typically due to errors captured by the ErrorReporter), UserError ''${fileName}' transpiling failed' is thrown. The fileName in the message is the path relative to node_modules.
Source
Thrown at packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts:1047
}
// eslint-disable-next-line prefer-template
throw new UserError(`Path '${absPath.replace(nodeModulesPath + '/', '')}' not found`);
}
return this.readModuleFile(absPath, errorsReport);
}
private readModuleFile(absPath: string, errorsReport: ErrorReporter) {
const nodeModulesPath = path.resolve('node_modules');
if (!moduleFileCache[absPath]) {
const content = fs.readFileSync(absPath, 'utf-8');
// eslint-disable-next-line prefer-template
const fileName = absPath.replace(nodeModulesPath + '/', '');
const transpiled = this.transpileFile(
{ fileName, content, isModule: true },
errorsReport
);
if (!transpiled) {
throw new UserError(`'${fileName}' transpiling failed`);
}
moduleFileCache[absPath] = transpiled; // TODO isolated transpiling
}
return moduleFileCache[absPath];
}
private isWhiteListedPackage(packagePath: string): boolean {
return packagePath.indexOf('-schema') !== -1 &&
(packagePath.indexOf('-schema') === packagePath.length - '-schema'.length);
}
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Check the accompanying compiler error output for the underlying transpile error in the reported file
- Import a build of the package with syntax the compiler supports (CommonJS/ES2015-ish dist)
- Pre-bundle or transpile the dependency yourself and import the built artifact
- Enable allowNodeRequire to load the module via native require instead of transpiling
Example fix
// before
import { x } from 'esm-only-pkg'; // ships ESM-only syntax
// after
import { x } from 'esm-only-pkg/cjs'; // CommonJS build Defensive patterns
Strategy: try-catch
Validate before calling
const path = require('path');
const src = fs.readFileSync(path.resolve('node_modules', modulePath), 'utf-8');
new Function(src); // throws SyntaxError if the module content is unparseable Try / catch
try {
await compiler.compile();
} catch (e) {
if (String(e.message).endsWith("' transpiling failed")) {
console.error('Module failed to transpile; check its syntax/syntax-level support:', e.message);
}
} Prevention
- Prefer packages shipping CommonJS/ES2015 dist builds
- Avoid importing TypeScript or ESM-only sources from data models
- Inspect the ErrorReporter output for the root transpile error
When it happens
Trigger: Importing a node_modules JS module from a data model whose content fails transpilation — syntax errors, unsupported syntax, or transpile errors reported to the ErrorReporter causing transpileFile to return null.
Common situations: Importing an ESM-only or TypeScript package into data models, a package shipping modern syntax unsupported by the compiler's Babel setup, or a corrupted/partial install in node_modules.
Related errors
- Unsupported Python multiple children node: ${node.constructo
- Empty Python atom_expr node: ${node.constructor.name}: ${nod
- Unsupported Python Trailer children node: ${node.constructor
- Unsupported Python vfpdef children node: ${node.constructor.
- Expected one parameter but nothing found
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/3574677a8e1cc261.
Report an issue: GitHub.