vercel/next.js · error
Configuring Next.js via '${basename(unsupportedConfig)}' is
Error message
Configuring Next.js via '${basename(unsupportedConfig)}' is not supported. Please replace the file with 'next.config.js', 'next.config.mjs', or 'next.config.ts'. What it means
Thrown at config.ts:2212 when Next.js cannot find a supported config file but does find one with an unsupported extension. The `findUp` search looks for `next.config.cjs`, `next.config.cts`, `next.config.mts` (only when Node's TypeScript feature is disabled), `next.config.json`, `next.config.jsx`, and `next.config.tsx`. Only `.js`, `.mjs`, and `.ts` are supported.
Source
Thrown at packages/next/src/server/config.ts:2213
}
return [finalConfig, meta]
} else {
const configBaseName = basename(CONFIG_FILES[0], extname(CONFIG_FILES[0]))
const unsupportedConfig = findUp.sync(
[
`${configBaseName}.cjs`,
`${configBaseName}.cts`,
// TODO: Remove `as any` once we bump @types/node to v22.10.0+
...((process.features as any).typescript ? [] : ['next.config.mts']),
`${configBaseName}.json`,
`${configBaseName}.jsx`,
`${configBaseName}.tsx`,
],
{ cwd: dir }
)
if (unsupportedConfig?.length) {
throw new Error(
`Configuring Next.js via '${basename(
unsupportedConfig
)}' is not supported. Please replace the file with 'next.config.js', 'next.config.mjs', or 'next.config.ts'.`
)
}
}
const clonedDefaultConfig = cloneObject(defaultConfig) as NextConfig
enforceExperimentalFeatures(clonedDefaultConfig, {
isDefaultConfig: true,
configuredExperimentalFeatures,
debugPrerender,
phase,
})
// always call assignDefaults to ensure settings like
// reactRoot can be updated correctly even with no next.config.jsView on GitHub (pinned to 0ae8c72462)
Solutions
- Rename the config file to `next.config.js`, `next.config.mjs`, or `next.config.ts`.
- If you have multiple config files, delete the unsupported one so only the supported name remains.
- For a JSON-style config, convert it to a `.js`/`.mjs` module that exports the object.
Example fix
// before: file named next.config.json
// after: rename to next.config.js and use module.exports = { ... } Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
const supported = ['next.config.js','next.config.mjs','next.config.ts'];
if (!supported.some(existsSync)) {
throw new Error('Rename config to a supported extension');
} Type guard
function isSupportedConfigName(name: string): boolean {
return ['next.config.js','next.config.mjs','next.config.ts'].includes(name);
} Prevention
- Name the config file `next.config.js`, `.mjs`, or `.ts` only.
- Delete JSON/cjs/tsx copies before starting the dev server.
When it happens
Trigger: Naming the config `next.config.json`, `next.config.cjs`, `next.config.tsx`, `next.config.jsx`, or `next.config.mts` (on a non-TypeScript Node).
Common situations: Renaming the file during a tooling change; committing a JSON copy of the config; scaffolding from a template that used a non-standard extension; migrating to TypeScript and using `.mts` instead of `.ts`.
Related errors
- Specified images.loaderFile does not exist at "${absolutePat
- Invalid handler fields configured for "cacheHandlers": ${inv
- You can not have a '_next' folder inside of your public fold
- No artifact run found in ${requested}. Expected a results.js
- `src` and `dest` are required
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/43bf09a2eb6f5c95.
Report an issue: GitHub.