Repository: next.js
Issue: Static output build crash in catch-all route, got error `[...all]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.`
Labels: bug,linear: next

### Link to the code that reproduces this issue

https://github.com/Innei/nextjs-catch-all-static-output-reproduction

### To Reproduce

The code: 

```
// [...all]/page.tsx


export async function generateStaticParams() {
  const jsonData = JSON.parse(
    readFileSync(resolve(process.cwd(), 'markdown/index.json'), {
      encoding: 'utf-8',
    }),
  )

  const sectionsText = [] as string[]

  const sections = [] as {
    path: string

    text: string
  }[]

  for (const path of jsonData) {
    const file = readFileSync(resolve(process.cwd(), 'markdown', path), {
      encoding: 'utf-8',
    })

    // sectionsText.push(file)
    sections.push({
      path: path.replace('.md', '').replace('./sections/', ''),
      text: file,
    })
  }

  console.log(sections, 'sections-page') // The value is not empty array with object.
// [ { path: '1.about', text: '# About' } ] ⬆️

  return sections
}

export default (props: any) => {
  return <pre>{JSON.stringify(props, null, 2)}</pre>
}

```


1. run build


log: 


```

   ▲ Next.js 14.1.0

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  . ⨯ ESLint must be installed in order to run during builds: pnpm install --save-dev eslint
 ✓ Linting and checking validity of types    
   Collecting page data  .[ { path: '1.about', text: '# About' } ] sections-page // See this

> Build error occurred
Error: Page "/reading/[...all]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
    at /Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/index.js:1102:59
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Span.traceAsyncFn (/Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:151:20)
    at async Promise.all (index 6)
    at async /Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/index.js:981:17
    at async Span.traceAsyncFn (/Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:151:20)
    at async /Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/index.js:918:124
    at async Span.traceAsyncFn (/Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:151:20)
    at async build (/Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/index.js:374:9)
    at async main (/Users/innei/git/reproduction/nextjs-catch-all-static-output-reproduction/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/bin/next:155:5)
   Collecting page data  . ELIFECYCLE  Command failed with exit code 1.
```

### Current vs. Expected behavior

current: Build crash

Expected: Should static output

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020
Binaries:
  Node: 20.8.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 8.14.1
Relevant Packages:
  next: 14.1.0
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: export
```


### Which area(s) are affected? (Select all that apply)

App Router

### Which stage(s) are affected? (Select all that apply)

next build (local)

### Additional context

I found some related issues, but they're not the same

#61213 #58171

<sub>[NEXT-2767](https://linear.app/vercel/issue/NEXT-2767/static-output-build-crash-in-catch-all-route-got-error-[all]-is)</sub>