Nuxt / renders index.vue locally but when deployed via Netlify returns 404
Hi, as the post says I'm having trouble seeing my default page render at
/
when deployed via Netlify
When I run the project locally everything works as expected
I'm using the Pages
directory atm and I made a index.vue
component
My project has ssr
set to false
and I'm runnin Nuxt as a SPA
Deployment: https://chirp-shot.netlify.app/
Code is set to private but here's my nuxt config
Solution:Jump to solution
Incase anyone finds this thread in the future
Do your Nuxt pages or index return 404 even though they are working in your local?
If so, did you rename any page files, specifically
index.vue
, from Page.vue
to page.vue
at any point?...Stack Overflow
How do you change the capitalization of filenames in Git?
I am trying to rename a file to have different capitalization from what it had before:
git mv src/collision/b2AABB.js src/collision/B2AABB.js
fatal: destination exists, source=src/collision/b2AABB....
Stack Overflow
git fails to detect renaming
One branch (refactoringBranch) had a complete directory restructure. Files were moved chaosly, but the content was preserved.
I tried to merge:
git merge --no-ff -Xrename-threshold=15 -Xpatience -
51 Replies
did it build successfully on netlify?
on netlify is your base directory set as /
build command: nuxt build
publish directory: dist
yes it successfully built
![No description](https://cdn.answeroverflow.com/1230748681834336306/image.png)
here are my settings
trying nuxt build to see if that fixes it
same result :/
https://answers.netlify.com/t/support-guide-i-ve-deployed-my-site-but-i-still-see-page-not-found/125
Netlify Support Forums
[Support Guide] I’ve deployed my site but I still see "Page not fou...
Last reviewed by Netlify Support - August, 2023 Netlify attempts to lookup a file based on several xor filters, and when all of these fail, we end up serving a 404 page. For example, a request made to /example/ would check /example/index.html, /example.html, /example/home.html and several other combinations (not necessarily in the same order) ...
try this maybe
file in public folder with
inside
Unfortunately that didn't work
I've been trying different things all day
What I know is, I can
npm run build
or npm run generate
locally, and then serve it with npx serve dist
or even npx server .output/public
Both work, but the moment I deploy this up to Netlify it just doesn't work
Even tried cloudflare pages and same resultah weird. i wish i knew more about nuxt to help you out.
what happens if you make a error.vue page? does that one get served instead of netlifys 404 page?
also just curious, what if you create a new nuxt project and try deploying that, does that work?
good afternoon! I tried both of those this morning to debug and the results are interesting
making a new nuxt site from scratch and deploying worked just fine. Using it I was able to bisect that the problem has to be in this apps code or config
I created a new error page and it is getting tripped on the initial load everytime
It shows this error
error caught during app initialization Error: Page not found: /
So it looks like for some reason when loading this app, it can't properly grab the index.vue page component
props.error.statusCode
does equal 404 so it checks out
when I build/generate locally however I don't get any of this, so I'm still a bit perplexed. I tried disabling all of my modules, but it has the same error so those shouldn't be affecting itDo other pages work fine?
Yeah, they've been fine
let me recheck real quick because I've made a lot of changes today
ok yeah theyre still working fine
hmmm... I think I might have possible error I've found
Oh great
This is the routes file generated from Netlify
All of the imports up top that have capitalized letters shouldn't
I renamed them a few days back to all be lowercase
Here's the deployed url btw if you wanna take a look: https://main--chirp-shot.netlify.app/
this could be nothing, but maybe the app loads, tries to import
Index.vue
instead of index.vue
, it cannot be found, error happens?Yeahh
Could be
because if I set the error page to redirect to
/
on a 404 status, the page renders on the 2nd attempt