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

Created on 20 Feb 2019  路  10Comments  路  Source: vercel/next.js

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

Screenshots

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

needs investigation

Most helpful comment

Jumping in to say that commenting out target: 'serverless' from my next.config.js also fixed the local build for me.

All 10 comments

Hi everybody....Any news about this?.... I need to put a implementation in production and I cant.... thanks...
Regards.... @timneutkens

Feel free to help investigate / solve the issue. 馃檹

@timneutkens the deploy function work in your stages?.... we need to know that to check the problem...because if the build-export work for you, is a different issue that if it is doesnt work.

I mean I haven't been able to even look into this issue yet. Hence why I was saying you could investigate it.

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. https://err.sh/zeit/now-builders/now-next-no-serverless-pages-
Any idea about that?....

I'm not sure what you mean, how does that relate to this issue?

I partially solved commenting in next.congif.js on export modules target: 'serverless', that just work fine to build and start production mode on local, but if you need to deploy your site, NOW requires that target uncommented.

Remember to delete your .next folder.

My npm scripts are :
"now-build": "NODE_ENV=production next build", "now-export": "NODE_ENV=production next start"

Jumping in to say that commenting out target: 'serverless' from my next.config.js also fixed the local build for me.

@FedeMadoery I just pulled down your repository and it appears to be working fine (build, export, and starting). I'm going to close this issue, if you are still having trouble feel free to leave a comment with more info.

I removed target: 'serverless' from the next.config file and it worked for me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jesselee34 picture jesselee34  路  3Comments

DvirSh picture DvirSh  路  3Comments

swrdfish picture swrdfish  路  3Comments

renatorib picture renatorib  路  3Comments

formula349 picture formula349  路  3Comments