Vite "Could not load ... ENOENT no such file or directory" in CI
Rollup tried to read a file referenced by an import or asset URL and the filesystem returned ENOENT. The file is absent on the fresh CI checkout even though it exists on the developer machine.
What this error means
vite build fails with "Could not load /app/src/assets/logo.svg (imported by src/App.tsx): ENOENT: no such file or directory". The same build works locally.
vite
error during build:
Could not load /app/src/assets/Logo.svg (imported by src/App.tsx):
ENOENT: no such file or directory, open '/app/src/assets/Logo.svg'Common causes
The file is git-ignored or never committed
A generated or ignored asset is present locally but absent on the clean runner, so the import has nothing to load.
Case mismatch between import and file
The import says Logo.svg but the committed file is logo.svg; the Linux runner is case-sensitive and reports ENOENT.
How to fix it
Commit the referenced file
- Confirm the path in the error is tracked by git with
git ls-files. - Add and commit the missing asset so the runner has it.
- Re-run the build on a clean checkout to confirm.
Terminal
git add src/assets/logo.svg
git status --shortMake the import path match the file exactly
Correct the casing so the import resolves on a case-sensitive filesystem.
src/App.tsx
// file on disk is logo.svg
import logo from './assets/logo.svg'How to prevent it
- Keep referenced assets tracked in git, not git-ignored.
- Match import path casing to the file on disk.
- Test the build on a clean checkout, not just the local working tree.
Related guides
Vite "Rollup failed to resolve import" build error in CIFix Vite "[vite]: Rollup failed to resolve import X" in CI - the production build cannot find a module that t…
Vite "Could not resolve entry module" build error in CIFix Vite "Could not resolve entry module (index.html)" in CI - Rollup cannot find the entry point because the…
Nuxt "500 ... Error during prerendering" in CIFix Nuxt "Error: 500 ... during prerendering" in CI - a route threw while Nitro prerendered it, often a faile…