Getting 404 on all css, javascript and other files

if i build the default next.js app, it doesnt display the css and javascript. when fetching it during the page load, it says failed to load resource 404 for the built css and javascript files. this has been happening with my tried projects and all the default next.js websites ive been trying to deploy. it looks fine when i use npm run dev, but it doesnt work when i deploy. Also, when i try to set the framework to next.js, it says it cant detect a next.js framework. the html loads fine, just the css, javascript and some other files from the _next/static folder.

the CSS, javascript and some other files like chunks or something wont load. they say failed to load resource 404 in dev tools

the code is just the default vercel app when you use npx create-next-app app --typescript and add output: “export” to next.config.ts

everything is default except for the above mentioned lines and to /repository/out to build options

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

bump

just trying to get an answer. this has been making it impossible for me to develop on next.js apps.

Hey @crlapples19-gmailcom!

In the future you’re likely to get answers faster by including more info. If your repo is public or have a minimal reproducible example, that’s usually the best way to get debugging help from the community. That way we can work together from the same code to figure out what’s going wrong. :smile:

Sure!

heres the github repo at

also i put it on github pages

so i didnt change any of the code from the default project and it just doesnt get past a 404 error when fetching css files and more from _next/static. i got some images to work with a basePath but thats about it.

heres another one

oh my god i fixed it. i had to move all the 404 files from the static folder to the out folder and update the href to /repository-name/filename

2 Likes

if it helps, the files still load if its in a folder i think without an underscore

2 Likes

I’m glad you got it working! Thanks for coming back to share the solution :smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.