Description
openedon Feb 29, 2024
Current Behavior
Creating a new NextJS Applictaion using nx g @nx/next:app my-new-app
with the following options:
✔ Which E2E test runner would you like to use? · cypress
✔ Would you like to use the App Router (recommended)? (Y/n) · true
✔ Would you like to use src/
directory? (Y/n) · true
generates a project which fails to build, error message:
`
nx run web2:build
▲ Next.js 14.0.4
✓ Creating an optimized production build
✓ Compiled successfully
Skipping linting
Checking validity of types .
We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:
- include was updated to add '.next/types/**/*.ts'
✓ Checking validity of types
Collecting page data .TypeError: n.createContext is not a function
at 1410 (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/chunks/823.js:1:81000)
at t (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/webpack-runtime.js:1:127)
at 908 (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/chunks/823.js:1:82414)
at t (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/webpack-runtime.js:1:127)
at 8205 (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/app/page.js:1:2178)
at Function.t (/Users/infom/Workspace/falvapp/org/apps/web2/.next/server/webpack-runtime.js:1:127)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/Users/infom/Workspace/falvapp/org/node_modules/next/dist/build/utils.js:884:17)
at async /Users/infom/Workspace/falvapp/org/node_modules/next/dist/build/utils.js:1100:17
at async Span.traceAsyncFn (/Users/infom/Workspace/falvapp/org/node_modules/next/dist/trace/trace.js:147:20)
Build error occurred
Error: Failed to collect page data for /
at /Users/infom/Workspace/falvapp/org/node_modules/next/dist/build/utils.js:1220:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
Collecting page data .Warning: command "next build" exited with non-zero status code
`
Generating with the same options, except not enabling App Router will generate an Application that compiles successfully.
Expected Behavior
Generating a new NextJS project can be built.
GitHub Repo
No response
Steps to Reproduce
- generate a new NextJS project with
nx g @nx/next:app my-new-app
- run
npx nx run my-new-app:build
Nx Report
NX Report complete - copy this into the issue template
Node : 21.6.1
OS : darwin-arm64
npm : 10.2.4
nx (global) : 18.0.5
nx : 18.0.5
@nx/js : 18.0.5
@nx/jest : 18.0.5
@nx/linter : 18.0.5
@nx/eslint : 18.0.5
@nx/workspace : 18.0.5
@nx/cypress : 18.0.5
@nx/devkit : 18.0.5
@nx/eslint-plugin : 18.0.5
@nx/nest : 18.0.5
@nx/next : 18.0.5
@nx/node : 18.0.5
@nx/react : 18.0.5
@nx/react-native : 18.0.5
@nrwl/tao : 18.0.5
@nx/vite : 18.0.5
@nx/web : 18.0.5
@nx/webpack : 18.0.5
typescript : 5.3.3
Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response