skip to Main Content

Error: Could not find a production build in the ‘.next’ directory. Try building your app with ‘next build’ before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id at setupFsCheck (E:crs admin and clientskillonorofffrontendnode_modulesnextdistser

i did run npm run build
but the problem repeating itself but not solving

solution for the problem

2

Answers


    1. Sometimes, clearing the Next.js build cache can resolve this issue.
      Delete the .next folder manually, and then run npm run build again.
    2. package.json has the correct script to start the production server.
      It should be something like this:
    "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint",
        "test": "husky"
      },
    Login or Signup to reply.
    1. Check your next config file is correctly set up.

      const nextConfig = {
      reactStrictMode: true,
      }

      module.exports = nextConfig

    2. Remove package-lock.json, node_modules, .next folder and files and reinstall.

    3. If the issue persists, try clearing your npm cache and rebuilding.
      Thanks

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search