-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next.js app build fails due to empty lang value #1162
Comments
I have similar issue. in my case app/layout.js render client component. and client component call useTranslation. first time has lang but when I refreshed browser, it just empty lang. I think this problem related layout.js |
Same issue here, the problem occurs when the core and the plugin packages get updated from v2.6.0 to v2.6.1. Might be helpful:
✓ Compiled successfully
Linting and checking the validity of types ...
Collecting page data ...
⚠ Using edge runtime on a page currently disables static generation for that page
Generating static pages (0/19) ...
RangeError: Incorrect locale information provided
at new PluralRules (<anonymous>)
at I18nProvider (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-translate/lib/cjs/I18nProvider.js:57:23)
at Wc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Incorrect locale information provided
at new PluralRules (<anonymous>)
at I18nProvider (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-translate/lib/cjs/I18nProvider.js:57:23)
at Wc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:[44](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:45))
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:[48](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:49)1)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
RangeError: Incorrect locale information provided
at new PluralRules (<anonymous>)
at I18nProvider (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-translate/lib/cjs/I18nProvider.js:57:23)
at Wc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Incorrect locale information provided
at new PluralRules (<anonymous>)
at I18nProvider (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next-translate/lib/cjs/I18nProvider.js:57:23)
at Wc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:2[53](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:54))
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:[70](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:71):481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:[76](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:77):89)
at Zc (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
at Z (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
at $c (/home/runner/work/tutur3u/tutur3u/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:[78](https://github.com/tutur3u/tutur3u/actions/runs/6573764237/job/17857443542?pr=972#step:7:79):98)
next-translate - compiled page: /[lang] - locale: en - namespaces: common, notifications - used loader: server /layout
Generating static pages (4/19)
next-translate - compiled page: /[lang] - locale: vi - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: en - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: vi - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: en - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: vi - namespaces: common, notifications - used loader: server /layout
Generating static pages (9/19)
next-translate - compiled page: /[lang] - locale: en - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: vi - namespaces: common, notifications - used loader: server /layout
next-translate - compiled page: /[lang] - locale: en - namespaces: common, notifications - used loader: server /layout |
Im facing the same issue here since I've updated to
|
timotew
added a commit
to timotew/next-translate
that referenced
this issue
Oct 25, 2023
aralroca
pushed a commit
that referenced
this issue
Nov 4, 2023
aralroca
pushed a commit
that referenced
this issue
Apr 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of this package are you using?
2.6.1 (same for the plugin)
What operating system, Node.js, and npm version?
Ubuntu 22.04.3 / 20.8.0 / 10.1.0
I used pnpm 8.8.0 to install dependencies
Next.js 13.5.4 with App router and middleware which adds /[lang] prefix
What happened?
Build failure occurred with below logs
What did you expect to happen?
I expected the build to succeed so I would have time to drink coffee
Are you willing to submit a pull request to fix this bug?
I looked into the part where the error occurred, I console.log-ed the input value of
I18nProvider
, it was as follows.In my case,
lang
was set to an empty string as a fallback (line 24), and an error occurred on line 28.In my case, this issue was resolved by adding an empty string to the fallback value of localesToIgnore on line 26 as shown below.
I haven't thoroughly analyzed exactly which cases cause this problem (I suspect it may be related to using
next-translate
in the top-levellayout
file), but just looking at the program logic, I think this modification is not bad.The text was updated successfully, but these errors were encountered: