问题描述
我正在尝试构建我的 react NEXT JS 应用程序,但是在我运行之后
npm 运行构建
我收到此错误:
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
我尝试从登陆/index.tsx 中的 getStaticProps 函数中删除 serverSideTranslations 方法
看起来像这样
export const getStaticProps = async ({ locale }) => {
return {
props: {
...(await serverSideTranslations(locale,[
"notifier","home",])),}
}
}
在我对 serverSideTranslations 中的代码进行注释后,应用程序构建正确。
我还有另一个页面,其中包含 getStaticPaths 和 getStaticProps,但它工作正常,没有错误。
// register/[encoded].tsx
export const getStaticProps = async ({ locale }) => {
return {
props: {
...(await serverSideTranslations(locale,[
"notifier"
])),}
}
}
我是 React 和下一个 js 开发的新手,所以也许我遗漏了一些东西,但它看起来像是一种奇怪的行为。
如果我运行,代码有效
npm 运行开发
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)