Cloudflare Pages and Bun install mismatch
/ 1 min read
Updated:Today I hit a Cloudflare Pages build failure where the local build passed, but the deployed build failed inside Vite/Tailwind:
[@tailwindcss/vite:generate:build] Missing field `tsconfigPaths` on BindingViteResolvePluginConfig.resolveOptionsThe important part of the Cloudflare log was not the Tailwind error itself. It was the install/build mismatch:
Installing project dependencies: npm install --progress=falseExecuting user command: bun run buildThis repo uses bun.lock, but Cloudflare installed dependencies with npm. That means the deploy could resolve a different dependency graph than the local Bun install, then run the build with Bun against those npm-installed packages.
The local check was useful because bun run build passed with the committed Bun lockfile. That narrowed the issue to Cloudflare’s build environment and install strategy, not the app code.
The fix is to make Cloudflare use Bun for dependency installation too:
bun install --frozen-lockfile && bun run buildAnd set this Cloudflare Pages environment variable:
SKIP_DEPENDENCY_INSTALL=trueOptionally pin Bun as well:
BUN_VERSION=1.3.10The lesson: when debugging static-site deploy failures, check the package manager used for installation separately from the package manager used for the build command. A passing local build does not mean much if the deploy is building against a different dependency tree.
Comments
Local graph
No local links yet · full graph →