kit: Missing "vite-manifest.json" file on build
Describe the bug
Building a SvelteKit application on one of my GitLab runners breaks with:
[vite-plugin-svelte-compile] ENOENT: no such file or directory, open '.../.svelte-kit/output/client/vite-manifest.json'
On my local machine, the build is fine. I was curious about the vite-manifest.json
file, and it looks like it’s actually generated:
✓ 1268 modules transformed.
.svelte-kit/output/client/_app/version.json 0.03 kB │ gzip: 0.05 kB
.svelte-kit/output/client/vite-manifest.json 38.84 kB │ gzip: 2.79 kB
...
But if I go inspect that folder after the build is complete, that file isn’t present. Does it get deleted at some point? Is there any chance of a race condition happening?
The exact line that spawns the error is:
Reproduction
I don’t know how to reproduce this, it’s only happening on a system I don’t control.
Logs
No response
System Info
System doesn't have external internet access, but it's using:
@sveltejs/adapter-static: 2.0.2
@sveltejs/kit: 1.15.7
svelte: 3.58.0
vite: 4.3.2
Severity
blocking all usage of SvelteKit
Additional Information
Apologies for the lack of a good reproduction, more so just trying to understand where to continue debugging the issue.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 23 (16 by maintainers)
Okay, summary of results from testing:
If you want to test it out yourself, here’s a snippet from package.json for an environment that works correctly (no error):
And one that does NOT work, outputting the error originally reported:
You’ll see that the only difference is SvelteKit. Note that adapter-static is capped at v1.0.6 for SvelteKit v1.3.0. Hope this helps solve the mystery.
Edit: Narrowed-in on exact minor versions from further testing
I also noticed that one of the pull requests from 1.3.1 ( https://github.com/sveltejs/kit/pull/8636 ) mentioned in the 1.3.1 release notes contains changes directly related to where the manifest file is loaded from. Might be a good starting point. Hope that helps.
Thanks @kiddailey
Can confirm when running
npm install @sveltejs/kit@1.3.0
and then tryingnpm run build
again it works fine!One observation I made is running
vite build
from the command line works, butnpm run build
, which essentially says"build": "vite build"
is failing. No clue why they should be behaving differently.Same for me, locking kit at 1.3.0 and adapter-static at 1.0.6 fixes the issue.
@Rich-Harris Sorry for the ping, but as the author of #8636 do you have any ideas about why it might be causing the server build to run twice under certain circumstances?