Vite "Could not load ... ENOENT no such file or directory" during build in CI
Vite resolved an import to a path but the file is not there. ENOENT means the operating system reported no such file, usually because of a wrong path, a case mismatch on Linux, or an asset that CI never generated.
What this error means
The build fails with "Could not load /app/src/assets/logo.png (imported by src/App.tsx): ENOENT: no such file or directory" during vite build.
error during build:
Could not load /app/src/assets/logo.png (imported by src/App.tsx):
ENOENT: no such file or directory, open '/app/src/assets/logo.png'Common causes
The file is missing or uncommitted
An asset referenced by an import was not committed, or is generated by a step that did not run before the build.
A case mismatch on a case-sensitive runner
The import case differs from the real file name; Linux runners treat Logo.png and logo.png as different files.
How to fix it
Ensure the file exists at the imported path
- Confirm the asset is committed and present at the exact path and case.
- If it is generated, run the generating step before the build.
- Re-run
vite buildto confirm it loads.
git status --porcelain src/assets
ls -l src/assets/logo.pngFix the import path case
Rename the import or the file so the case matches what exists on disk.
git mv src/assets/Logo.png src/assets/logo.pngHow to prevent it
- Commit every asset your imports reference.
- Run asset-generating steps before the Vite build.
- Match import path case to real file names for Linux runners.