Ask questionsError: Cannot find module '.next\server\pages-manifest.json'

Bug report

Describe the bug

When starting in prod mode (doing next build and npm start), this error occurs when I try to navigate to the page in the browser.

When run 'next build && next export', this error occurs immediately.

To Reproduce

  1. Clone the repo
  2. Run yarn install
  3. Run next build
  4. Run yarn start or 'npm run start' / Run the 'start' script of package.json
  5. Go to localhost:8000 in Chrome
  6. Error appear in the console where you ran step 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' }

System information

  • OS: [Windows, Linux]
  • Browser: [Chrome]
  • Version of Next.js: [8.0.2-canary.4]

Additional context

We had had the same error with Version of Next.js: 8.0.0 and 8.0.1


Answer questions LuisBonsembiante

Ok @timneutkens I found a solution for next export and build ...if I put module.exports = { target: 'server'}, in next.config.js....all working fine localy..but if a try to put all in production stage in zeit-now...the logs said me that;] Error: No serverless pages were built. Any idea about that?....

Github User Rank List