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
- Install
solid-jsand save it todependencies. - Commit the updated
package.jsonand lockfile. - Use
npm ciin CI so the lockfile is honored exactly.
Terminal
npm install solid-js
git add package.json package-lock.jsonDo 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 ciHow to prevent it
- Keep
solid-jsindependencies, not only installed locally. - Use
npm ciagainst a committed lockfile in CI. - Avoid
--omit=devwhen the build needs those packages.
Related guides
SolidJS "build failed" when vite-plugin-solid is missing in CIFix SolidJS "build failed" in CI when vite-plugin-solid is not in vite.config - Solid JSX is not transformed…
SolidStart "vinxi build" command failed in CIFix "vinxi build" failures in CI for SolidStart - the vinxi bundler that drives SolidStart exited non-zero, f…
Qwik "Cannot find module '@builder.io/qwik-city'" in CIFix "Cannot find module '@builder.io/qwik-city'" in CI - the QwikCity package is not installed on the runner,…