next build or next dev fails because next-intl cannot locate its request configuration
Your error
Error: Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router1 more line it can showFix it fast
Most common cause, 1 of 3The request configuration file does not exist
Create the file with getRequestConfig and return at least the locale and messages.
// i18n/request.ts (or src/i18n/request.ts)
import { getRequestConfig } from 'next-intl/server'
export default getRequestConfig(async () => {
const locale = 'en'
return {
locale,
messages: (await import(`../messages/${locale}.json`)).default,
}
})Short answer
next-intl needs two pieces in the App Router: the next-intl/plugin wrapper in next.config, and a request configuration file at i18n/request.ts (or src/i18n/request.ts). The error appears when the file is missing, sits somewhere else without its path being given to createNextIntlPlugin(), or when next.config does not use the plugin at all. Fix whichever piece is missing.
Which cause do you have?
Check both pieces at once: is the plugin in next.config, and where is the request config file?
grep -n "next-intl/plugin\|createNextIntlPlugin\|withNextIntl" next.config.*
ls i18n/request.* src/i18n/request.* 2>/dev/nullThen find the line you see in this list and open its fix:
- 1The request configuration file does not exist
No i18n/request.* in the project root or in src/ - 2The file lives in a custom place and the plugin was not told
You have a request config, but under a path like config/i18n.ts - 3next.config does not wrap the config with the plugin
i18n/request.ts exists, but next.config exports a plain object
What does the error look like?
Error: Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-routerError occurred prerendering page "/t". Read more: https://nextjs.org/docs/messages/prerender-error
Cause 1 of 3
The request configuration file does not exist
You seeNo i18n/request.* in the project root or in src/
Check
The plugin docs say the file is looked up as i18n/request with a .ts, .tsx, .js or .jsx extension, both in src and in the project root. Projects set up from an older guide often have i18n.ts at the root instead.
find . -path ./node_modules -prune -o -name 'request.*' -print -o -name 'i18n.*' -printFix
Create the file with getRequestConfig and return at least the locale and messages.
// i18n/request.ts (or src/i18n/request.ts)
import { getRequestConfig } from 'next-intl/server'
export default getRequestConfig(async () => {
const locale = 'en'
return {
locale,
messages: (await import(`../messages/${locale}.json`)).default,
}
})Verify
next build gets past prerendering the pages that call getTranslations or useTranslations.
npx next buildConfirmed by next-intl.dev
Cause 2 of 3
The file lives in a custom place and the plugin was not told
You seeYou have a request config, but under a path like config/i18n.ts
Check
Only the default paths are searched. Any other location has to be passed to createNextIntlPlugin, either as the first argument or as requestConfig in the options object.
grep -rn "getRequestConfig" --include=*.ts --include=*.js . | grep -v node_modulesFix
Give the plugin the path relative to the project root.
// next.config.ts
import createNextIntlPlugin from 'next-intl/plugin'
const withNextIntl = createNextIntlPlugin('./config/i18n.ts')
export default withNextIntl({})Verify
Build again; the pages that use translations prerender.
npx next buildConfirmed by next-intl.dev
Cause 3 of 3
next.config does not wrap the config with the plugin
You seei18n/request.ts exists, but next.config exports a plain object
Check
The request file is wired in by the plugin. Without the wrapper, next-intl's server functions have no way to load the file, and the same error is raised.
cat next.config.*Fix
Wrap the existing config. If other plugins also wrap it, pass the result of one into the next so none of them is dropped.
import type { NextConfig } from 'next'
import createNextIntlPlugin from 'next-intl/plugin'
const nextConfig: NextConfig = {
// your options
}
const withNextIntl = createNextIntlPlugin()
export default withNextIntl(nextConfig)Verify
A clean build finishes and the page renders the translated text.
rm -rf .next && npx next buildConfirmed by next-intl.dev
How do I stop it coming back?
- Keep i18n/request.ts at the default path unless you have a strong reason not to.
- When you combine several next.config wrappers, add a build in CI so a lost wrapper fails early.
- Follow the guide for your next-intl major version; file names changed between releases.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies: