nextjs build_error ai_generated partial

错误:路径 '/[slug]' 的静态生成在 60 秒后超时。考虑增加静态生成超时时间。

Error: Static generation timed out after 60 seconds for path '/[slug]'. Consider increasing the static generation timeout.

ID: nextjs/static-generation-timeout-slug

其他格式: JSON · Markdown 中文 · English
75%修复率
83%置信度
1证据数
2023-08-10首次发现

版本兼容性

版本状态引入弃用备注
Next.js 13.3+ active
Next.js 14.0 active
Next.js 15.0 active

根因分析

在静态生成期间(例如,使用 `output: export` 或 `generateStaticParams`),页面渲染时间超过默认的 60 秒超时,通常由于数据获取缓慢或计算量大。

English

During static generation (e.g., with `output: export` or `generateStaticParams`), a page takes longer than the default 60-second timeout to render, often due to slow data fetching or heavy computation.

generic

官方文档

https://nextjs.org/docs/messages/static-generation-timeout

解决方案

  1. Increase the timeout in next.config.js: `module.exports = { staticGenerationTimeout: 120 }`
  2. Optimize data fetching in the page: use caching, limit the number of items in `generateStaticParams`, or use incremental static regeneration.

无效尝试

常见但无效的做法:

  1. 70% 失败

    This prevents static generation entirely, but if the project requires static export (`output: export`), dynamic rendering is not allowed.

  2. 50% 失败

    It only masks the issue; if the underlying cause (slow data fetch) isn't fixed, builds become unreasonably long.

  3. 85% 失败

    Breaking change: without it, dynamic routes won't be pre-rendered for static export, causing build failures.