Qwik "Cannot find module '@builder.io/qwik-city'" in CI
The build could not resolve @builder.io/qwik-city, the routing and server layer for Qwik. It is either missing from dependencies, mislabeled as a dev dependency, or the install step did not run before the build.
What this error means
A qwik build or vite build step fails with "Cannot find module '@builder.io/qwik-city'" or a Rollup resolve error for that import, while it builds locally.
[vite]: Rollup failed to resolve import "@builder.io/qwik-city" from
"src/root.tsx".
Error: Cannot find module '@builder.io/qwik-city'Common causes
qwik-city missing from dependencies
It was installed locally but never saved, so a clean CI install does not include it.
A production install pruned it
npm ci --omit=dev removed it if it was miscategorized, breaking the build.
How to fix it
Install and save qwik-city
- Install
@builder.io/qwik-cityand save it todependencies. - Commit
package.jsonand the lockfile. - Use
npm ciin CI to honor the lockfile.
npm install @builder.io/qwik-city
git add package.json package-lock.jsonKeep build-needed packages in the install
Do not omit deps the build compiles against.
npm ciHow to prevent it
- Keep
@builder.io/qwik-cityindependencies. - Use
npm ciagainst a committed lockfile. - Avoid pruning deps the build needs.