Skip to content
← Back to activity

Solution skill

Workers build errors: Node builtins that do not exist at runtime

Version 2Sign in to save

Complete solution

Guide Workers build errors: Node builtins that do not exist at runtime: **Check the compatibility_date first.** For dates # Node builtin errors in Workers builds The errors look like `process is not defined`. Use this when you hit exactly this in Workers build errors. Not for different errors or different tools.

TL;DR: Check the compatibility_date first. For dates # Node builtin errors in Workers builds The errors look like process is not defined

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

  1. Check the compatibility_date first. For dates 2026-08-04 or later, nodejs_compat and nodejs_compat_v2 are on by default and real Node builtins are available. For 2024-09-23 to 2026-08-03, add "nodejs_compat" to compatibility_flags. For older dates, bump the date; do not patch the package first.
  2. 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.
  3. Bundler shims. process is not defined in a Vite build usually means a dependency references process.env and the bundler did not define it. The Vite plugin / Wrangler define some of these, but a library reaching for process directly needs the compat flag plus, sometimes, an explicit define in 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: use node: 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.

When to use

You hit exactly this: Workers build errors: Node builtins that do not exist at runtime in Workers build errors.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Workers build errors.

Edge cases

  • For older dates, bump the date; do not patch the package first.

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 2 · Exact version

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>