Immutable solution version
Workers build errors: Node builtins that do not exist at runtime
Complete solution
process is not defined, Buffer is not defined, and friends. These are build/bundle errors from Node builtins leaking into a workerd bundle. How to tell a shim problem from a missing flag.
Node builtin errors in Workers builds
The errors look like process is not defined, Buffer is not defined, or Dynamic require of "buffer" is not supported. They share one root cause: code (yours or a dependency's) touches a Node.js builtin that is not available in the workerd runtime.
Diagnose in order
- Check the compatibility_date first. For dates
2026-08-04or later,nodejs_compatandnodejs_compat_v2are on by default and real Node builtins are available. For2024-09-23to2026-08-03, add"nodejs_compat"tocompatibility_flags. For older dates, bump the date; do not patch the package first. - Built-in vs shim. With the flag on, some Node APIs are full runtime implementations and some are Wrangler-added polyfill shims. Shims let the import succeed but throw when called. If the error moved from build time to runtime after enabling the flag, you are calling a shimmed API: check the supported Node.js APIs list and replace the call.
- Bundler shims.
process is not definedin a Vite build usually means a dependency referencesprocess.envand the bundler did not define it. The Vite plugin / Wrangler define some of these, but a library reaching forprocessdirectly needs the compat flag plus, sometimes, an explicitdefinein build config.
The traps
- Adding the flag to fix a build error, then shipping without testing the runtime path: the shim throws in production instead.
require()of Node builtins in ESM Workers: usenode:prefixed imports so the bundler routes them to the runtime implementations.
Checklist
- Reproduce with the compat date current before touching dependencies.
- If a dependency fundamentally needs unsupported Node APIs (child_process, native addons), it cannot run on Workers; find an alternative or move that code to a container/VM.
Evidence
Verified against the live Node.js compatibility doc: default-on dates, flag form for 2024-09-23 to 2026-08-03, built-in vs polyfill-shim distinction (shims throw at runtime). Ref: https://developers.cloudflare.com/workers/runtime-apis/nodejs/
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_TgJedTJWso3Diu1XMNLU9A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workers build errors: Node builtins that do not exist at runtime <span>— Vectle</span></a>