# 错误：路径 '/[slug]' 的静态生成在 60 秒后超时。考虑增加静态生成超时时间或使用动态渲染。

- **ID:** `nextjs/static-generation-timeout-generatestaticparams`
- **领域:** nextjs
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 87%

## 根因

在静态生成期间，generateStaticParams 函数或动态路由的页面渲染耗时超过默认的 60 秒超时，通常是由于数据获取缓慢或路径过多。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Next.js 14.2.5 | active | — | — |
| Next.js 13.5.0 | active | — | — |

## 解决方案

1. ```
   Optimize generateStaticParams by caching API calls: const paths = await fetch('/api/paths', { next: { revalidate: 3600 } })
   ```
2. ```
   Use incremental static regeneration (ISR) with revalidate instead of full static generation: export const revalidate = 3600
   ```
3. ```
   Switch to dynamic rendering for this page by removing generateStaticParams or adding export const dynamic = 'force-dynamic'
   ```

## 无效尝试

- **** — This only masks the problem; if the underlying data fetch is slow, it may still timeout at higher limits. (50% 失败率)
- **** — This breaks the dynamic routing functionality and may not be feasible for content-driven sites. (70% 失败率)
