Search code examples
next.jsnetlify

Next.js Deploy to Netlify


I am trying to deploy my Next.js app into Netlify using Github, the build succeeds, but when I open the page it says "page not found". Additionally, my repo consists of two files: front_end where my next.js repo lives and back_end where my solidity smart contract lives.

These are my build settings Build settings

How can I ensure that the page is found?


Solution

  • I found the answer here with my problem by a user kirillibrahim:

    https://answers.netlify.com/t/deployment-of-nextjs-website-page-not-found/28870/4

    [build]
       command = "npm run build && npm run export"
       publish = "out"
    

    netlify.toml at root folder

    "scripts": {
       "export": "next export"
    },
    

    package.json at root folder

    Build settings for the netlify project;

    Build command: npm run build && npm run export

    Publish directory: out