Rollup "Could not resolve entry module" - Fix the Input Path in CI
Rollup could not find the entry file named by input. The path is wrong, the file is missing in CI, or Rollup is running from a different working directory than the path assumes.
What this error means
Rollup aborts before bundling with [!] RollupError: Could not resolve entry module "<input>". It is deterministic - the entry path simply does not resolve.
[!] RollupError: Could not resolve entry module "src/index.js".
at error (/app/node_modules/rollup/dist/shared/parseAst.js:396:30)
at ModuleLoader.loadEntryModule (/app/node_modules/rollup/dist/shared/rollup.js:...)Diagnose it: is it resolution, transform, or memory?
Bundler failures in CI fall into three families and the error text often points at the wrong one. A module that resolves on your machine and not on the runner is nearly always case sensitivity or a missing optional dependency; a transform error is a config or version mismatch; and an unexplained kill with no stack is the out-of-memory reaper, not a build error at all.
# 1. resolution: does the file exist with EXACTLY that case?
git ls-files | grep -i "the/imported/path"
# 2. transform: what versions is CI actually resolving?
npm ls webpack vite rollup esbuild typescript 2>/dev/null | head -20
# 3. memory: was it killed rather than failed?
# exit 137 = SIGKILL (OOM). Nothing in the bundler log will explain it.
node --max-old-space-size=4096 node_modules/.bin/vite buildCommon causes
Wrong or stale input path
The input in rollup.config.js (or --input) points at a file that was moved, renamed, or never existed at that path.
Wrong cwd or partial checkout in CI
Rollup runs from a different directory than expected, or a sparse/shallow checkout omits the entry file, so the relative path resolves to nothing.
How to fix it
Point input at the real entry file
Set input to the path that actually exists from the project root.
// rollup.config.js
export default {
input: 'src/index.ts', // must exist relative to cwd
output: { file: 'dist/bundle.js', format: 'es' },
}Run from the right directory and verify the file
- Confirm cwd and that the entry exists:
ls -la src/index.ts. - Run Rollup from the project root so relative
inputresolves. - Check the CI checkout actually contains the entry file.
Make the build reproducible before you debug it
- Pin the Node major in
setup-nodeand inengines. A bundler that resolves native bindings will pick a different prebuilt binary across majors. - Delete
node_moduleslocally and reinstall from the lockfile before concluding the runner is at fault; most "works locally" reports are stale local state. - Set
CI=truelocally to reproduce. Several toolchains change behaviour under it, including treating warnings as errors. - Exit code 137 is an out-of-memory kill. Raise
--max-old-space-sizeor move to a larger runner rather than searching the bundler config.
How to prevent it
- Keep
inputaligned with the real source layout. - Run Rollup from a consistent working directory in CI.
- Ensure the checkout includes the entry file the config references.