I am trying to build my react NEXT JS application, but after I run
npm run build
I am getting this error:
Error occurred prerendering page "/it/landing". Read more: https://nextjs.org/docs/messages/prerender-error
Error: next-i18next was unable to find a user config
. . .
Error: Export encountered errors on following paths:
/it/landing
I tried removing serverSideTranslations method from the getStaticProps function inside the landing/index.tsx
which look like this
export const getStaticProps = async ({ locale }) => {
return {
props: {
...(await serverSideTranslations(locale, [
"notifier",
"home",
])),
}
}
}
After I commented the code in serverSideTranslations, the app builds properly.
I also have another page which contains both getStaticPaths and getStaticProps, but it is working fine, with no errors.
// register/[encoded].tsx
export const getStaticProps = async ({ locale }) => {
return {
props: {
...(await serverSideTranslations(locale, [
"notifier"
])),
}
}
}
I am new in react and next js developement so maybe I am missing something, but it look like a strange behaviour.
The code works if I run
npm run dev