Skip to content
Latchkey

Qwik "qwik build" command failed in CI

The qwik build script runs the client build, the server build, and the optimizer in sequence. A failure in any stage (adapter output, config, or a $ serialization error) aborts the whole build in CI.

What this error means

A npm run build step running qwik build stops with a Vite/optimizer error or a missing adapter step, and the CI job exits non-zero.

qwik
$ qwik build
vite v5 building for production...
[Qwik Optimizer Error] captured value is not serializable
Error: build.server failed

Common causes

A failing stage in the composite build

qwik build chains client, server, and lint/typecheck; any one failing (often the optimizer) fails the command.

A misconfigured build script or adapter

A custom script that drops the server build or lacks the adapter step produces an incomplete or failing build.

How to fix it

Read which stage failed and fix it

  1. Look at whether the error is in build.client, build.server, or the optimizer.
  2. Fix the underlying cause (serialization, missing adapter, or config).
  3. Keep the standard qwik build script so all stages run in order.
package.json
{
  "scripts": { "build": "qwik build" }
}

Install cleanly first

Run npm ci so the Qwik CLI and plugins are present before the build.

Terminal
npm ci
npm run build

How to prevent it

  • Keep the standard qwik build script intact.
  • Fix optimizer/serialization errors before they reach the server build.
  • Use npm ci so the Qwik toolchain is installed.

Related guides

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