Vite cannot find an entry point to scan in Docker or CI
Could not auto-determine entry point from rollupOptions or html filesShort answer
Vite scans your .html files, or the input you configure, to find what to pre-bundle. This error means it found none. In Docker the usual reason is that index.html never reached the image, or the command runs in the wrong folder. Check the file is there, then set the input or optimizeDeps.entries if your page is not at the root.
Fix it fast
1Find out which cause you have
Run the same command in the same folder the build uses and list what is there. Inside Docker, do it in the built image.
docker run --rm my-app ls -la /app2Match what you see, then jump to its fix
- 1
ls shows package.json and node_modules but no index.htmlindex.html is not in the folder Vite runs fromFix - 2
index.html exists on your machine but not in the image.dockerignore removes the entry file from the build contextFix - 3
index.html is in a subfolder, or you build a library with no pageThe page lives elsewhere and no entry is configuredFix
- 1
What does the error look like?
Could not auto-determine entry point from rollupOptions or html files
Cause 1 of 3
index.html is not in the folder Vite runs from
1Check
By default Vite builds from index.html in the project root and crawls .html files for dependencies. A COPY step that skips it, a wrong WORKDIR, or a build run one level up leaves nothing to crawl.
grep -n "COPY\|WORKDIR" Dockerfile
ls index.html2Fix
Copy the project files into the image and run the command in the folder that holds index.html.
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build3Verify
Rebuild the image; the error is gone.
docker build -t my-app .Confirmed by vite.dev
Cause 2 of 3
.dockerignore removes the entry file from the build context
1Check
Files matching .dockerignore are removed from the build context before it is sent, so COPY cannot add them to the image.
cat .dockerignore2Fix
Delete the pattern that matches index.html or the folder holding it, or add a negation for it.
# .dockerignore
node_modules
dist
!index.html3Verify
Rebuild without cache and list the folder.
docker build --no-cache -t my-app .
docker run --rm my-app ls /app/index.htmlConfirmed by docs.docker.com
Cause 3 of 3
The page lives elsewhere and no entry is configured
1Check
Vite crawls html files, but when you set input it crawls that instead. If you set optimizeDeps.entries yourself, it replaces the automatic search entirely.
grep -n -B2 -A4 "input\|entries" vite.config.*2Fix
Point entries at the real files, relative to the project root. For a multi-page app, list each html file as an entry.
// vite.config.js
import { defineConfig } from 'vite'
export default defineConfig({
optimizeDeps: {
entries: ['src/pages/**/*.html'],
},
})3Verify
Run the dev server or the build again.
npx vite buildConfirmed by vite.dev
How do I stop it coming back?
- Run npx vite build in a clean clone in CI, so a file missing from git or .dockerignore shows up before deploy.
- Keep one WORKDIR and copy to it explicitly.
- After setting optimizeDeps.entries, remember it overrides the automatic search.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Web apps
vite build cannot find index.html, especially inside Docker
Could not resolve entry module (index.html)
Vite treats index.html as the entry of the app and looks for it in the project root, which is the folder where you run the command.
4 causes, each with a fixWeb apps
Keycloak token issuer does not match when the app runs in Docker
Invalid token issuer
Keycloak builds token and discovery URLs from the hostname it is reached with.
3 causes, each with a fixWeb apps
Playwright cannot open a headed browser on a Linux server or in Docker
npx playwright test --headed shows no window on a Linux server
A headed browser needs a display, and a Linux server or container has none.
3 causes, each with a fixWeb apps
React dev server in Docker does not reload when you save a file
Changes appear only after docker compose restart or a rebuild
File-change events often do not cross from your host into a container, so the dev server never notices the edit.
3 causes, each with a fixWeb apps
npm install fails with 'sh: node-gyp-build: command not found'
npm error command failed
A package's install script calls node-gyp-build by name.
2 causes, each with a fixWeb apps
T3 Env stops the build with Invalid environment variables
Error: Invalid environment variables
T3 Env validates process.env against your Zod schema when the app starts or builds, and stops on the first failure.
4 causes, each with a fix