'how to create production build in NextJS app

The following error is occured when run cmd "next build".

enter image description here



Solution 1:[1]

Add a build script in your package.json, so that you can run npm run build or yarn build. Just make sure next is installed as one of the dependencies.

"scripts": {
    "dev": "next dev",
    "start": "next start",
    "build": "next build"
  },

Alternatively, you may run npx next build.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hangindev.com