Skip to content
Latchkey

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.

rollup
[!] 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.

Terminal
# 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 build

Common 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
// 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

  1. Confirm cwd and that the entry exists: ls -la src/index.ts.
  2. Run Rollup from the project root so relative input resolves.
  3. Check the CI checkout actually contains the entry file.

Make the build reproducible before you debug it

  • Pin the Node major in setup-node and in engines. A bundler that resolves native bindings will pick a different prebuilt binary across majors.
  • Delete node_modules locally and reinstall from the lockfile before concluding the runner is at fault; most "works locally" reports are stale local state.
  • Set CI=true locally 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-size or move to a larger runner rather than searching the bundler config.

How to prevent it

  • Keep input aligned with the real source layout.
  • Run Rollup from a consistent working directory in CI.
  • Ensure the checkout includes the entry file the config references.

Frequently asked questions

What causes Rollup "Could not resolve entry module"?
There are 2 common causes: wrong or stale input path and wrong cwd or partial checkout in ci. The input in rollup.config.js (or --input) points at a file that was moved, renamed, or never existed at that path.
How do I fix Rollup "Could not resolve entry module"?
There are 2 fixes depending on which cause you have: point input at the real entry file and run from the right directory and verify the file. Work through them in order, since the first is the most common.
What does Rollup "Could not resolve entry module" actually mean?
Rollup aborts before bundling with [!] RollupError: Could not resolve entry module "<input>".
How do I stop Rollup "Could not resolve entry module" happening again?
Keep input aligned with the real source layout. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card