0

我为国际化添加了应用程序 next-i18next。之后vercel中的所有页面都变成了404页面。

顺便说一句,它在本地完美运行。

为什么??

const { i18n } = require("./next-i18next.config");

module.exports = {
  i18n: {
    locales: ["en", "fr", "nl-NL", "nl-BE", "de", "ja"],
    defaultLocale: "ja",

https://skripts.vercel.app/

以上是我网站的网址。日志中有这个错误。

Failed to load resource: the server responded with a status of 500 ()
4

1 回答 1

0

也许您需要将“getStaticProps”添加到动态路由页面?

// pages/blog/[slug].js
export const getStaticPaths = ({ locales }) => {
  return {
    paths: [
      // if no `locale` is provided only the defaultLocale will be generated
      { params: { slug: 'post-1' }, locale: 'en-US' },
      { params: { slug: 'post-1' }, locale: 'fr' },
    ],
    fallback: true,
  }
}

这在这里描述: https ://nextjs.org/docs/advanced-features/i18n-routing#dynamic-routes-and-getstaticprops-pages

我有 React + Next.js + next-i18next + Vercel 应用程序。当我部署到 Vercel 时,我开始在控制台中收到错误:

Internal Server Error 500 with all *.json files.

我刚刚添加了“语言环境”键-> 值,这解决了我的问题。

于 2021-11-23T16:55:46.723 回答