vercel/next.js · error · Error
Could not parse output from TypeScript's --showConfig.
Error message
Could not parse output from TypeScript's --showConfig.
What it means
Thrown by getTypeScriptConfigurationCli() when `tsc --showConfig` succeeds (exit 0) but its stdout is not valid JSON and JSON.parse throws. Next.js invokes the TypeScript CLI to expand the tsconfig into a fully-resolved config; if the CLI emits unexpected output (a banner, warning, or non-JSON text), parsing fails.
Source
Thrown at packages/next/src/lib/typescript/runTypeScriptCli.ts:253
tscPath: string
}): Promise<{ compilerOptions: Record<string, any> }> {
const result = await runTypeScriptCli({
cwd: baseDir,
tscPath,
args: ['--showConfig', '--project', tsConfigPath, '--pretty', 'false'],
captureOutput: true,
})
if (result.exitCode !== 0) {
throw new Error(
[result.stdout, result.stderr].filter(Boolean).join('\n').trim()
)
}
try {
return JSON.parse(result.stdout)
} catch (cause) {
throw new Error(`Could not parse output from TypeScript's --showConfig.`, {
cause,
})
}
}
View on GitHub (pinned to 0ae8c72462)
Solutions
- Run `npx tsc --showConfig --project tsconfig.json --pretty false` manually and inspect stdout — it must be pure JSON.
- Disable experimental.useTypeScriptCli in next.config.js to fall back to the TypeScript compiler API path.
- Remove any NODE_OPTIONS preloads or banners that write to stdout.
- Ensure you are using a supported TypeScript version; if on a native preview, confirm --showConfig JSON output is stable.
Example fix
// before: experimental.useTypeScriptCli enabled with a tsc that pollutes stdout
// after (next.config.js)
module.exports = { experimental: { useTypeScriptCli: false } } Defensive patterns
Strategy: try-catch
Validate before calling
import { execSync } from 'child_process'
function validateTscShowConfig(tscPath: string, tsConfigPath: string) {
const out = execSync(`node ${tscPath} --showConfig --project ${tsConfigPath} --pretty false`, { encoding: 'utf8' })
JSON.parse(out) // throws if not JSON
} Try / catch
try {
const config = await getTypeScriptConfigurationCli({ baseDir, tsConfigPath, tscPath })
} catch (err) {
if (err.message.includes("Could not parse output from TypeScript's --showConfig")) {
// disable experimental.useTypeScriptCli and fall back to the API path
}
throw err
} Prevention
- If you hit this, disable experimental.useTypeScriptCli.
- Ensure no NODE_OPTIONS preload writes to stdout.
- Pin a TypeScript version whose --showConfig emits stable JSON.
- Test tsc --showConfig output manually before enabling the CLI path.
When it happens
Trigger: experimental.useTypeScriptCli is enabled and `tsc --showConfig --project tsconfig.json --pretty false` returns non-JSON stdout. Causes: a custom tsc wrapper printing to stdout, a TypeScript version whose --showConfig output differs, or stdout pollution from a Node.js preload/banner.
Common situations: Using TypeScript 7 (native preview) whose CLI output format differs; a NODE_OPTIONS preload that logs to stdout; a malformed tsconfig that makes tsc emit diagnostics to stdout instead of stderr while still exiting 0; shell wrapper aliasing tsc.
Related errors
- Could not parsetsconfig.json. Please make sure it contains s
- `forbidden()` is experimental and only allowed to be enabled
- `unauthorized()` is experimental and only allowed to be used
- The experimental.allowDevelopmentBuild option requires NODE_
- `experimental.cssChunking: "graph"` is only supported with T
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/e18c4573d9f4f4b6.
Report an issue: GitHub.