Skip to content
Latchkey

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

  1. Confirm the path in the error is tracked by git with git ls-files.
  2. Add and commit the missing asset so the runner has it.
  3. Re-run the build on a clean checkout to confirm.
Terminal
git add src/assets/logo.svg
git status --short

Make 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →