-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting 404 error during "npm run build", but not "npm run dev" (simple static adapter website) #2962
Comments
An addendum: I'm not using TypeScript, so the config file for that is unused (?) |
There's not much info here for us to debug, please provide a repro on github or stackblitz. The repro should be minimal and created from scratch so proprietary shouldn't be an issue, it would also help narrow the cause too. |
Working on it... |
Ok, I built a demo test site which very closely mirrors my actual site. It has all the basic functionality: all the routes, the image gallery, the nav bar, the header and footer that appears on every page, the ability to make the footer disappear when you click on it, etc. Page for page and feature for feature, it's the same website, just with my company stuff left out (and it uses smaller pages - fewer paragraphs and images). And I can use "npm run build" without error. The only way I can help you resolve this is to send you both my test site repository (zipped up) and my official repository so you can compare. So, my question is: what non-identifying files & folders can I send you from my official repository that you can use to do this comparison? Clearly, something changed and/or got corrupted at some point in my official build setup. I'm way too dumb to be able to figure that out, so you're gonna have to do it for me! In the meantime, I'm gonna make a copy of the demo site folder and copy my REAL files into it and see if I can resolve the problem on my end that way. Thanks |
One thing I've found is my site builds fine when I use adapter-auto, but not adapter-static. Pulling my hair out... |
Ok, I was able to finally reproduce the problem. When I changed the demo site's adapter to adapter-static, the problem reared it's head. Included below. (I omitted the node_modules directory, but kept everything else.) Let me know if you need anything else. Thanks... |
I had an identical issue. I found that it's happening when your routing folder doesn't have index.svelte. |
Thanks, but I have other routes that work (or, at least, used to work) without index.svelte. My website ran fine for several months, and then builds stopped working for some reason, even though I only make cosmetic changes for the most part. Is index.svelte now a requirement? |
The |
Yes, my project worked fine without index.svelte before as well. Unfortunately, I haven't noticed from what sveltekit version it happened. |
Ok, I downgraded SvelteKit to "1.0.0-next.195" and that fixed the problem, so I started incrementing upwards, and the problem reappeared in "1.0.0-next.200", so the "200" update broke something (or exposed a flaw in my website)... |
I downgraded to 1.0.0-next.199 in my package.json file in my official website configuration and was able to do an official release build. Yay! |
Sorry, got a lot busy recently, but thanks for tracking this down! That means something in v200 failed, which is likely #2832. If someone wants to help out, feel free to debug that PR. |
The path to static files in release build with adapter-static has been an unresolved issue for at least 50 versions it seems, bizarre. |
I also got problems after #2832, in my case it is a combination of the following:
I added a work-around, by adding an extra empty route at
|
Same here. I downgraded to I made a repro on this branch. |
I get the same error too on any image links.
svelete-config.js import sveltePreprocess from 'svelte-preprocess' /** @type {import('@sveltejs/kit').Config} */
} export default config |
I am also impacted by this error with same two resolutions: A) downgrading to "@sveltejs/kit": "1.0.0-next.199" The issue was definitely introduced by #2832 and is reproduced in conjunction with using adapter-static. |
Both repros work correctly with the current version of SvelteKit, so whatever the bug was we can regard it as fixed — closing |
I have a brand new repo that shows this problem as well: https://github.com/quintesse/comix-sense |
I had the same error and I found what happend, is simple when you run "npm run build" as static it start to compile the project and svelte verify all routes used as local routes, as you are using "/support/FAQ/..." in some href, sveltekit is trying to find this route but it is not defined in your project may be because a typo or you just wrote any route to fill the atribute when testing. If you run as "npm run dev" it will not show the error |
Hello, i know that this issue have been closed already, but i would like to share a similar problem i had with my project using static-adapter on @sveltejs/kit: ^1.11.0 When i build the project in my local computer, the files are generated correctly and the build works fine. But i get the same error on my github actions CI. Here the link of the failing job: And my project repository: The problem is about a 404 error on the "/" path. And i can't have more ideas about how this could fail on CI... Thanks in advance for any help. |
Adding the following in the head of my app.html fixed the error for me: |
im having this problem too. svg files load in npm run dev but not during build. im using |
Describe the bug
After a recent npm update (which I'm assuming updated Svelte, but correct me if I'm wrong), I've started getting a 404 error when attempting to do a release build. It doesn't happen when I do a preview build (see attached image).
My site is a very simple static webpage (using adapter-static). No stub routing, no spaces in image filenames, etc.
Reproduction
See files I've attached here. Since this error occurs at build time (and not during website usage), I'm not sure how to respond to this.
My website is proprietary and thus not on Github. I can send the full repository to a Svelte maintainer via ProtonMail if necessary. Please advise.
Logs
I'm not sure what logs to include. If you need any, please advise. Thank you in advance for your help...
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: