I am trying to compile the app using npm run build
I get error:
▲ Next.js 15.1.7
Environments: .env
Creating an optimized production build …
✓ Compiled successfully
Linting and checking validity of types …Failed to compile.
.next/types/app/[…page]/page.ts:34:29
Type error: Type ‘PageProps’ does not satisfy the constraint ‘import(“C:/Users/Admin/builder-app/.next/types/app/[…page]/page”).PageProps’.
Types of property ‘params’ are incompatible.
Type ‘{ page: string; }’ is missing the following properties from type ‘Promise’: then, catch, finally, [Symbol.toStringTag]
32 |
33 | // Check the prop type of the entry function
34 | checkFields<Diff<PageProps, FirstArg<TEntry[‘default’]>, ‘default’>>()
| ^
35 |
36 | // Check the arguments and return type of the generateMetadata function
37 | if (‘generateMetadata’ in entry) {
Next.js build worker exited with code: 1 and signal: null
This error is happening because the params field in your PageProps type is expected to be a Promise, but you have it as a plain object ({ page: string }).
Specifically, this part of the error:
Type ‘{ page: string; }’ is missing the following properties from type ‘Promise’
Likely cause:
You’re probably using generateStaticParams, dynamic routing (e.g., [...page]), or params in your layout/page file, and the type definition is not matching the expected structure that Next.js generated during build.
Solution:
Inspect your PageProps type and compare it to what Next.js expects.
If you have something like:
type PageProps = {
params: { page: string }
}
Try updating it to match the expected type (which is probably asynchronous):
type PageProps = {
params: Promise<{ page: string }>
}
But this is unusual — usually params is not a Promise, so the real problem might be the other way around: your component is treating params as a Promise, when it should be just an object.