Closed Johannes-Andersen closed 3 years ago
same having error to me *projectFolder = in pubilc project folder
What version of Next.js are you using? v12.0.1
What version of Node.js are you using? Attempted: node/14.18.1
What browser are you using? Chrome (N/A)
What operating system are you using? macOS catalina / window 10
pack
"next": "^12.0.1",
"react": "^18.0.0-alpha-4298ddbc5-20211023",
"react-dom": "^18.0.0-alpha-4298ddbc5-20211023",
next.config
experimental: {
concurrentFeatures: true,
serverComponents: true,
},
swcMinify: true
tsconfig
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./src",
"types": [
"jest"
],
"incremental": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
error - Error: ENOENT: no such file or directory, open 'projectFolder.next\server\middleware-ssr-runtime.js' Module not found: Can't resolve 'projectFolder/pages/_document' in 'projectFolder'
who have this erorr same as us ....!?
Clicked the wrong button, reopened
It could just have been next-i18next that needs to add support
@Johannes-Andersen If i can found solution i will coment here :(
Similar issue for me as well, v12.0.0 works, v12.0.1 unable to build / run, log is different but might have the same root issue.
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /404
at pageNotFoundError (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/server/load-components.js:58:23)
at /home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/trace/trace.js:74:20)
info - Generating static pages (1/1)
> Build error occurred
Error: Export encountered errors on following paths:
/404
at /home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/export/index.js:493:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Span.traceAsyncFn (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/trace/trace.js:74:20)
at async /home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/build/index.js:956:17
at async Span.traceAsyncFn (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/trace/trace.js:74:20)
at async /home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/build/index.js:830:13
at async Span.traceAsyncFn (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/trace/trace.js:74:20)
at async Object.build [as default] (/home/starburst/notessimo-web/notessimo-web/node_modules/next/dist/build/index.js:80:25)
I got this problem with a fresh project and this next.config.js:
module.exports = {
reactStrictMode: true,
experimental: {
concurrentFeatures: true,
serverComponents: true
}
}
Seems like concurrentFeatures: true
is the issue and is broken in v12.0.1, turning it off fix it for me.
just trying resolve fallback:
{
webpack: (config) => {
config.resolve.fallback = { fs: false };
return config;
},
}
Edit My bad, on the server was running a not supported version of Node (10) while next 12 needs Node.js 12.22.0 or later
Similar issue for me with next.js 12.0.1, i can build the app on my local machine (windows 10) but it fails on the server ( ubuntu 20.04) For every page i get this error :
Error [ERR_METHOD_NOT_IMPLEMENTED]: The _write() method is not implemented
at Writable._write (_stream_writable.js:566:6)
at doWrite (_stream_writable.js:415:12)
at clearBuffer (_stream_writable.js:545:7)
at Writable.uncork (_stream_writable.js:319:7)
Update: #30642 resolves the "Module not found: Can't resolve 'projectFolder/pages/_document'" issue.
For the "Cannot resolve fs" error, since concurrentFeatures
enables the Edge Runtime, there will be some constraints applied. For example Native Node.js APIs are not supported. We will make sure to improve the error message here.
Related docs: https://nextjs.org/docs/advanced-features/react-18#enable-ssr-streaming-alpha and https://nextjs.org/docs/api-reference/edge-runtime#unsupported-apis.
Closing based on comment from shuding above.
The errors I had above is gone when I removed the fs
dependency and upgraded to 12.0.2-canary.13 to remove the "Module not found: Can't resolve 'projectFolder/pages/_document'"
issue.
Just noting, I am now seeing a new issue when concurrentFeatures
is true:
johannesandersen@Bel-MBP-JAndersen Johand % npm run build && npm start
> johand@0.0.1 build
> next build
warn - You have enabled experimental feature(s).
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.
warn - SWC minify beta enabled. https://nextjs.org/docs/messages/swc-minify-enabled
info - Checking validity of types
info - Using the createRoot API for React
warn - You are using an unsupported prerelease of 'react-dom' which may cause unexpected or broken application behavior. Continue at your own risk.
info - Using the experimental web runtime.
info - You have experimental React Server Components enabled.
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data
[ ] info - Generating static pages (0/6)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /500
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
Error occurred prerendering page "/en/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /404
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
Error occurred prerendering page "/en/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /500
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
Error occurred prerendering page "/nb-NO/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /404
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
Error occurred prerendering page "/nb-NO/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /500
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Cannot find module for page: /404
at pageNotFoundError (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:16:17)
at getPagePath (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:39:15)
at Object.requirePage (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/require.js:44:22)
at Object.loadComponents (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/server/load-components.js:58:23)
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/worker.js:218:63
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
info - Generating static pages (6/6)
> Build error occurred
Error: Export encountered errors on following paths:
/404
/500
/en/404
/en/500
/nb-NO/404
/nb-NO/500
at /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/export/index.js:493:19
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
at async /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/build/index.js:956:17
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
at async /Users/johannesandersen/Desktop/Johand/node_modules/next/dist/build/index.js:830:13
at async Span.traceAsyncFn (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/trace/trace.js:74:20)
at async Object.build [as default] (/Users/johannesandersen/Desktop/Johand/node_modules/next/dist/build/index.js:80:25)
But that does not seem related to this issue.
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
What version of Next.js are you using?
Attempted:
v12.0
.,v12.0.2-canary.2
andv12.0.2-canary.11
What version of Node.js are you using?
Attempted: node/14.18.1 and node/16.13.0
What browser are you using?
Chrome (N/A)
What operating system are you using?
macOS Monterey
How are you deploying your application?
Vercel
Describe the Bug
When updating from v12.0.0 to v12.0.1 it broke
next build
andnext dev’.
next lint` still worksLooking into the canary versioned packages: "12.0.1-canary.0" - WORKS "v12.0.1-canary.1" - DOES NOT WORK
So it could possibly be: #30299
next build output:
Nex dev output:
Expected Behavior
When running
npm run build
it should creating an optimized production buildTo Reproduce
npm install
3, and then try and build the app