Page not found error after deploy

I was having trouble with directory error when deploying my website and then I changed from dist to .next (I had previous Next.js websites deployed but I forgot this when deploying this one).

Then the website was succesful deployed but it presented Page not found error when acessing it through the link: Page Not Found (task-app456.netlify.app)

Obs: my website has only one page, I am not trying to acess other pages for example: taskapp/contact, it has only one page and not working.

GitHub repo: HigorR456/Task-App: This is a to do list, this app has add and remove task option, in the futere I’ll add edit task button, auto sort per start time, theme switcher and o ther features. (github.com)

See the building log here:

10:58:52 AM: build-image version: 5e2052dbf11f1636a7bac1839aff8991d186d620 (focal)
10:58:52 AM: buildbot version: 5e2052dbf11f1636a7bac1839aff8991d186d620
10:58:52 AM: Fetching cached dependencies
10:58:52 AM: Starting to download cache of 169.0MB
10:58:54 AM: Finished downloading cache in 1.874s
10:58:54 AM: Starting to extract cache
10:58:55 AM: Finished extracting cache in 1.149s
10:58:55 AM: Finished fetching cache in 3.068s
10:58:55 AM: Starting to prepare the repo for build
10:58:55 AM: Preparing Git Reference refs/heads/main
10:58:56 AM: Parsing package.json dependencies
10:58:57 AM: Starting to install dependencies
10:58:57 AM: Started restoring cached Node.js version
10:58:58 AM: Finished restoring cached Node.js version
10:58:58 AM: v16.19.1 is already installed.
10:58:58 AM: Now using node v16.19.1 (npm v8.19.3)
10:58:58 AM: Enabling Node.js Corepack
10:58:58 AM: Started restoring cached build plugins
10:58:58 AM: Finished restoring cached build plugins
10:58:58 AM: Started restoring cached corepack dependencies
10:58:58 AM: Finished restoring cached corepack dependencies
10:58:59 AM: No npm workspaces detected
10:58:59 AM: Started restoring cached node modules
10:58:59 AM: Finished restoring cached node modules
10:58:59 AM: Installing npm packages using npm version 8.19.3
10:58:59 AM: up to date, audited 211 packages in 443ms
10:58:59 AM: 35 packages are looking for funding
10:58:59 AM:   run `npm fund` for details
10:58:59 AM: found 0 vulnerabilities
10:58:59 AM: npm packages installed
10:59:00 AM: Python version set to 3.8
10:59:00 AM: Attempting Ruby version 2.7.2, read from environment
10:59:01 AM: Using Ruby version 2.7.2
10:59:01 AM: Started restoring cached go cache
10:59:01 AM: Finished restoring cached go cache
10:59:02 AM: Installing Go version 1.19.5 (requested 1.19.5)
10:59:06 AM: go version go1.19.5 linux/amd64
10:59:07 AM: Using PHP version 8.0
10:59:07 AM: Install dependencies script success
10:59:07 AM: Starting build script
10:59:07 AM: Using stage install dependencies
10:59:08 AM: Detected 1 framework(s)
10:59:08 AM: "next" at version "13.2.4"
10:59:08 AM: Section completed: initializing
10:59:09 AM: ​
10:59:09 AM:   Netlify Build                                                 
10:59:09 AM: ────────────────────────────────────────────────────────────────
10:59:09 AM: ​
10:59:09 AM: ❯ Version
10:59:09 AM:   @netlify/build 29.7.1
10:59:09 AM: ​
10:59:09 AM: ❯ Flags
10:59:09 AM:   baseRelDir: true
10:59:09 AM:   buildId: 6422f29996193100080d6ce1
10:59:09 AM:   deployId: 6422f29996193100080d6ce3
10:59:09 AM: ​
10:59:09 AM: ❯ Current directory
10:59:09 AM:   /opt/build/repo
10:59:09 AM: ​
10:59:09 AM: ❯ Config file
10:59:09 AM:   /opt/build/repo/netlify.toml
10:59:09 AM: ​
10:59:09 AM: ❯ Context
10:59:09 AM:   production
10:59:09 AM: ​
10:59:09 AM:   1. build.command from netlify.toml                            
10:59:09 AM: ────────────────────────────────────────────────────────────────
10:59:09 AM: ​
10:59:09 AM: $ npm run build
10:59:09 AM: > task-app@0.1.0 build
10:59:09 AM: > next build
10:59:10 AM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
10:59:10 AM: info  - Linting and checking validity of types...
10:59:12 AM: info  - Creating an optimized production build...
10:59:15 AM: info  - Compiled successfully
10:59:15 AM: info  - Collecting page data...
10:59:20 AM: info  - Generating static pages (0/3)
10:59:20 AM: info  - Generating static pages (3/3)
10:59:21 AM: info  - Finalizing page optimization...
10:59:21 AM: Route (pages)                              Size     First Load JS
10:59:21 AM: β”Œ β—‹ /                                      3.76 kB          77 kB
10:59:21 AM: β”œ   /_app                                  0 B            73.3 kB
10:59:21 AM: β”” β—‹ /404                                   182 B          73.4 kB
10:59:21 AM: + First Load JS shared by all              74.2 kB
10:59:21 AM:   β”œ chunks/framework-2c79e2a64abdb08b.js   45.2 kB
10:59:21 AM:   β”œ chunks/main-7477d36a73a3487c.js        27 kB
10:59:21 AM:   β”œ chunks/pages/_app-cb4d59606a29a817.js  296 B
10:59:21 AM:   β”œ chunks/webpack-8fa1640cc84ba8fe.js     750 B
10:59:21 AM:   β”” css/e956ab2bf8369065.css               908 B
10:59:21 AM: β—‹  (Static)  automatically rendered as static HTML (uses no initial props)
10:59:21 AM: ​
10:59:21 AM: (build.command completed in 11.4s)
10:59:21 AM: ​
10:59:21 AM:   2. Deploy site                                                
10:59:21 AM: ────────────────────────────────────────────────────────────────
10:59:21 AM: ​
10:59:21 AM: Starting to deploy site from '.next'
10:59:21 AM: Calculating files to upload
10:59:21 AM: 16 new files to upload
10:59:21 AM: 0 new functions to upload
10:59:21 AM: Section completed: deploying
10:59:21 AM: Site deploy was successfully initiated
10:59:21 AM: ​
10:59:21 AM: (Deploy site completed in 659ms)
10:59:21 AM: ​
10:59:21 AM:   Netlify Build Complete                                        
10:59:21 AM: ────────────────────────────────────────────────────────────────
10:59:21 AM: ​
10:59:21 AM: (Netlify Build completed in 12s)
10:59:21 AM: Starting post processing
10:59:22 AM: Caching artifacts
10:59:22 AM: Started saving node modules
10:59:22 AM: Finished saving node modules
10:59:22 AM: Started saving build plugins
10:59:22 AM: Post processing - HTML
10:59:22 AM: Finished saving build plugins
10:59:22 AM: Started saving corepack cache
10:59:22 AM: Finished saving corepack cache
10:59:22 AM: Started saving pip cache
10:59:22 AM: Finished saving pip cache
10:59:22 AM: Started saving emacs cask dependencies
10:59:22 AM: Finished saving emacs cask dependencies
10:59:22 AM: Post processing - header rules
10:59:22 AM: Started saving maven dependencies
10:59:22 AM: Finished saving maven dependencies
10:59:22 AM: Started saving boot dependencies
10:59:22 AM: Finished saving boot dependencies
10:59:22 AM: Post processing - redirect rules
10:59:22 AM: Started saving rust rustup cache
10:59:22 AM: Finished saving rust rustup cache
10:59:22 AM: Started saving go dependencies
10:59:22 AM: Finished saving go dependencies
10:59:23 AM: Post processing done
10:59:22 AM: Build script success
10:59:22 AM: Section completed: building
10:59:23 AM: Section completed: postprocessing
10:59:23 AM: Uploading Cache of size 169.1MB
10:59:24 AM: Site is live ✨
10:59:25 AM: Section completed: cleanup
10:59:25 AM: Finished processing build request in 32.884s

Hi there,

Did you see this guide yet? This is the best place to start for β€œPage Not Found” issues.

If you are still seeing issues after following the troubleshooting steps in there, please check out this Support Guide as well. It outlines all of our build and deploy resources and will get you on the right track :slight_smile:

If none of the above resources help, please write back with your site name and what steps you have tried and we can look into this further!

1 Like

Hi Sam, I solved the problem by deleting the folder .next from my project through VSCode, then I run the β€˜npm run dev’ command on terminal and it recreated the folder again, I commited and it worked fine.

I have no idea what caused this problem, but in the.next/server/pages folder there was some pages missing, I’ve noticed that when comparing this project with the previous one that I had done, that is why I deleted the folder and when it was recreated the folder got the same files as the project I had done previously.

So whoever is with the same problem, make sure your .next folder be like in the image below (if you created your project with β€˜npm create next-app’) in mine there was some files missing and an weird .html file.

image

Ahh perfect! Thanks for reaching back out and letting us know you resolved your problem! (: :rocket: