【问题标题】:NEXTJS 404 in deployment to docker, but not in dev environmentNEXTJS 404 部署到 docker,但不在开发环境中
【发布时间】:2023-02-14 23:58:42
【问题描述】:

出于某种原因,我在实际上在本地工作的路线上收到 404。 这是我的下一个配置:

const nextConfig = {
  reactStrictMode: true,
  experimental: {
    appDir: true,
     output: 'standalone',

  }
}

包 json: "next": "13.1.1", 当应用程序加载时,我收到此错误:

Invalid next.config.js options detected: 
  - The value at .experimental has an unexpected property, output

我能做些什么?我再次使用 appDir,它在本地工作。

这是我的码头图像FROM node:16-alpine

谢谢

【问题讨论】:

  • 同样的问题,请问有新的资料吗?
  • @Artegon - 对不起,但没有......我搬回去做出反应......我认为它还没有准备好,太多的实验功能......
  • 我刚刚找到了解决方案,请参阅我的答案。

标签: docker next.js


【解决方案1】:

您需要将 output 放在 experimental 中,而不是放在 module.exports 的第一层中。

module.exports = {
  output: 'standalone',
  experimental: {
    appDir: true
  },
}

【讨论】:

    猜你喜欢
    • 2015-04-03
    • 2021-04-22
    • 1970-01-01
    • 2017-11-19
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 1970-01-01
    相关资源
    最近更新 更多