Skip to content
Latchkey

SolidJS "Cannot find module 'solid-js'" in CI

Node or the bundler could not resolve solid-js on the runner. The package is either not listed as a dependency, was pruned as a dev dependency in a production install, or the install step never ran.

What this error means

The build fails with "Cannot find module 'solid-js'" or Rollup "failed to resolve import 'solid-js'", even though it builds locally where the package is present.

node
[vite]: Rollup failed to resolve import "solid-js" from "src/index.tsx".
This is most likely unintended because it can break your application at runtime.
Error: Cannot find module 'solid-js'

Common causes

solid-js is not in dependencies

It was installed locally but never saved to package.json, so a clean CI install does not fetch it.

A production-only install pruned it

npm ci --omit=dev skipped solid-js if it was miscategorized as a dev dependency.

How to fix it

Add solid-js as a dependency

  1. Install solid-js and save it to dependencies.
  2. Commit the updated package.json and lockfile.
  3. Use npm ci in CI so the lockfile is honored exactly.
Terminal
npm install solid-js
git add package.json package-lock.json

Do not omit deps needed to build

If the build compiles against solid-js, do not prune dev/prod deps that the bundler needs.

.github/workflows/ci.yml
npm ci

How to prevent it

  • Keep solid-js in dependencies, not only installed locally.
  • Use npm ci against a committed lockfile in CI.
  • Avoid --omit=dev when the build needs those packages.

Related guides

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