I am afraid that you will not be able to deploy Nextjs to Netlify without losing functionality.
It should work, meaning that it will not throw errors, with the following netlify.toml
command = "npm run build && npm run export"
publish = "out"
If you read Nextjs docs on the next export command you will see that you lose a bunch of very interesting Nextjs features.
I moved my app over to Vercel ( Nextjs own deployment structure ) due to this.
See also this discussion
Have you seen these articles? They talk through best practices for Next.js on Netlify:
They may not solve all of your problems, but I think they will solve some
Hi Dennis, Hi everyone.
I’m Lowi, newbie here.
I’m stuck with 404 page though the deployment is published.
I’m using an Eleventy theme that runs in localhost.
I checked the /index.html and it seems good.
Please could you help me?
Thanks in advance!
Here’s a pic showing deploy log
Hi, @lowi307. What site is this for?
You can private message (PM) that to one of our support staff and I’ve confirmed that PMs are enabled for your community login. Note, that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.
Hi @luke, thanks for replying!
I sent you a PM for better communication, then I’ll post the solution here.
I deployed my site with a custom domain I purchased from you guys and I’m getting a 404 error with “Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.”
TL;DR: switch from BrowserRouter to HashRouter.
I was able to enter my react site with the link and even access the routes with the nav links BUT when i refresh any page exept the homepage the i got this annoying 404 error (I already have my styled 404 page) and when i try to access any page from the url even if it exist i get the same 404 error.
I switched from using BrowserRouter to use HashRouter from react-router-dom
I just started using Github, and I realized that my code was rather properly written and I was able to publish it as well, but for some very odd reason “Page not found” error kept popping up. Even after downloading the Deploy, as instructed, I can see that the downloaded “published” file has the “index.html” in it. Would you be able to assist me with this?
@rmanshani06 Welcome to the Netlify community.
Please provide your Netlify site name, domains, and other information when you post. The better the post = the faster we can help!
Is your index.html at the top level of your website? That’s where it must be. If it is in a sub-folder the default URL won’t find it.
Netlify Site Name: Coding Practice
Domain Name: https://practical-varahamihira-e3e406
I hope this helps.
When you say if it’s at the top level of my website, can you elaborate a little on that?
Site’s loading for me out in the UK! You may want to clear your browser’s cache .
the reason why I contacted you was regarding the fact that if you submit on the Demo Contact Tab, that is when the “error” pops up of the “Page Not Found”. Instead, I think it should be “Thank you for your response”. You can correct me, if I am wrong about this?
To be more specific, the Form submission tab is what is not working for me on Github and that is when the error pops up of “Page Not Found”.
You’ll want to ensure you add a success page successfully. You should check out the docs!
If you continue to encounter errors, please create a new topic as we’re now looking more specifically at forms.
I just began HTML/CSS and I created my repository & Linked it with Netlify yet i get the same issue what do i do?
hi there, did you read the guide on resolving this issue?
yes but i do not understand what i must do can you explain it to me like a baby
Netlify Site Name: https://discordvuejs.netlify.app/
Still having “page not found”
checked build command
checked publish directory
Hi, @YousefAbood. We would be happy to troubleshoot and explain more about why this is happening. Would you please send us a link to the non-working site?
but there isn’t any index.html. Are you building a static version of your site or does your site require a node application server to work?
I am having the same issue of page not found even though I have index.html file in the root folder.