Skip to content
Latchkey

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.

node
[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

  1. Install @builder.io/qwik-city and save it to dependencies.
  2. Commit package.json and the lockfile.
  3. Use npm ci in CI to honor the lockfile.
Terminal
npm install @builder.io/qwik-city
git add package.json package-lock.json

Keep build-needed packages in the install

Do not omit deps the build compiles against.

.github/workflows/ci.yml
npm ci

How to prevent it

  • Keep @builder.io/qwik-city in dependencies.
  • Use npm ci against a committed lockfile.
  • Avoid pruning deps the build needs.

Related guides

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