next.js: Error: Cannot find module '.next\server\pages-manifest.json'

Bug report

Describe the bug

When starting in dev mode, this error occurs when I try to navigate to the page in the browser

Screenshots

{ 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' }

System information

  • OS: [Windows 10 ]
  • Browser [chrome]
  • Version of Next.js: [ 8.0.1]

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 10
  • Comments: 18 (9 by maintainers)

Most upvoted comments

@popuguytheparrot Try deleting .next and running next dev again?

Sure. Nothing happens

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.

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>

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

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.

~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.