Sutirtha Dey
Sutirtha Dey

Reputation: 17

404 page not found on nextJs app refreshing on netlify

This is the link to my GitHub project, see the directory structure: https://github.com/SutirthaDey/crowdcoin app link: https://crowdcoins.netlify.app/

I have used react,nextJs, and next routes for dynamic routing. The problem I'm facing is after deploying it using netlify, everything is working fine but when I do a refresh, it's showing 404 pages not found(except the main index.js page/landing page). I don't know whether I was doing it appropriately but tried several things like using netlify.toml and _redirects but nothing really worked. Other than the refreshing part, everything is working fine.

Upvotes: 0

Views: 919

Answers (1)

Rhys Shepherd
Rhys Shepherd

Reputation: 1

I was stressing out for days over this its such unique problem that I couldn't find the answer too anywhere. I also followed the same Solidity tutorial as you and unfortunately the tutorial is very out of date so a lot of things don't really work. I had the exact same issue as you when trying to build on netlify. It took a while to figure out but basically the next-routes package does not work with netlify. So you will have to set up your routes just using vanilla Next.js. So delete the server.js and routes.js files then search up how to create routes using Next.js I would suggest these tutorials they are very good! Next routes tutorials. Hopefully this helps others I don't want anyone else to go through what I had to go through lol

Upvotes: 0

Related Questions