When starting in dev mode, this error occurs when I try to navigate to the page in the browser
{ Error: Cannot find module 'C:\core\.next\server\pages-manifest.json'
> Building page: /_error
WAIT at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
Compiling...15:26:08 at Function.Module._load (internal/modules/cjs/loader.js:535:25)
at Module.require (internal/modules/cjs/loader.js:663:17)
at require (internal/modules/cjs/helpers.js:20:18)
at getPagePath (C:\core\node_modules\next-server\dist\server\require.js:14:27)
at Object.requirePage (C:\core\node_modules\next-server\dist\server\require.js:30:22)
at Object.loadComponents (C:\core\node_modules\next-server\dist\server\load-components.js:15:34)
at DevServer.renderToHTMLWithComponents (C:\core\node_modules\next-server\dist\server\next-server.js:196:48)
at DevServer.renderToHTML (C:\core\node_modules\next-server\dist\server\next-server.js:202:37)
at DevServer.renderToHTML (C:\core\node_modules\next\dist\server\next-dev-server.js:101:22)
at processTicksAndRejections (internal/process/next_tick.js:81:5) code: 'MODULE_NOT_FOUND' }
@popuguytheparrot Try deleting .next
and running next dev
again?
@popuguytheparrot Try deleting
.next
and runningnext dev
again?
Sure. Nothing happens
Please provide a reproduction.
I had this issue.
I had a _document.js file and was doing things with styled-components but didn't actually have the styled components package in my project
~Getting this error. Should I take the latest canary release?~
Somehow restarted server, deleted .next cache a couple of times and the error went away.
Getting the same error with Version of Next.js: [8.0.0, 8.0.1 and 8.0.2-canary.4]
Error: Cannot find module 'C:\...\.next\server\pages-manifest.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:20:18)
at getPagePath (C:\...\node_modules\next-server\dist\server\require.js:14:27)
at Object.requirePage (C:\...\node_modules\next-server\dist\server\require.js:30:22)
at Object.loadComponents (C:\...\node_modules\next-server\dist\server\load-components.js:15:34)
at Server.renderToHTMLWithComponents (C:\...\node_modules\next-server\dist\server\next-server.js:196:48)
at Server.renderToHTML (C:\...\node_modules\next-server\dist\server\next-server.js:202:37)
at Server.render (C:\...\node_modules\next-server\dist\server\next-server.js:185:33) code: 'MODULE_NOT_FOUND' }
@FedeMadoery same to me...
I've been trying fixing for 4 days now, it's a headache. I tested with 5 different versions and all have different problems.
@FedeMadoery @LuisBonsembiante post a new issue, provide a reproduction, we'd be happy to look into it. Saying "I get this error" doesn't allow us to know where the error came from to debug it.
Because this issue comes up first in Google when searching for Cannot find module '.next\server\pages-manifest.json'
, I wanted to share my fix:
I was using await
within pages/_document.js#getInitialProps()
, but forgot to add async
to getInitialProps()
.
@jesstelford did you see it in latest stable next?
This is happening to me when importing firebase-functions
anywhere in the project.
I had the same problem. I removed serverless: true
option in the next.config.js
file and it helped me.
Have any of you had any luck with this? I'm also having the same issue. Even tried running without my custom _app
and _document
and it still didn't work. Removing the serverless
option makes the production version work fine.
I had the same problem. I removed
serverless: true
option in thenext.config.js
file and it helped me.
This works!
I think this page in tutorial should be updated to prevent some hicups for new joiners in NextJS community. Export into a Static HTML App
Basically if you are coming straight from the previos tutorial section (aka _Deploying a Next.js App_) serverless: true
will be hanging there in the config file; not a big deal, but might streamline the learning experiences.
in my case it was an open link tag in _document.js
using "next": "^8.0.1"
// build failed
<Head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" >
</Head>
// build succeeded
<Head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
</Head>
I am going to take a wild guess:
I think this happens when webpack build fails. It is unable to write the manifest file and then next.js is unable to read it.
I'm going to try to reproduce @aricma 's report and see if the error can be displayed in a better way.
My issue was that I was running a PostCSS step as a part of my dev
run script:
"dev:css": "yarn watch:css & next",
"watch:css": "postcss ./styles/index.tailwind.css -o components/.utilities.css -w",
I debugged by deploying another project and porting across my current project to it in chunks.
Agree that the error message is not helpful and could be improved.
fwiw, I just ran into this and deleting my .next and node_modules, then npm install
then running npm run dev
fixed it for me
Most helpful comment
Sure. Nothing happens