[GH-ISSUE #7799] [Bug] Build scripts fail under Bun: verifier-source-loader imports node:module registerHooks #4644

Closed
opened 2026-10-31 00:51:43 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Ercaner1988 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7799

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Setup, packaging, or upgrade

Observed behavior

On main at 570abe95f (REA 6.8.0), the build step scripts/generate-skill-metadata.mjs exits 1 under Bun before doing any work:

SyntaxError: Export named 'registerHooks' not found in module 'node:module'.
Bun v1.4.4 (Windows x64)

scripts/lib/verifier-source-loader.mjs has a static import, import { registerHooks, stripTypeScriptTypes } from "node:module"; (line 2), and calls registerHooks(...) at line 112. Bun fails when linking the module, so the whole script fails, not only the hook call.

The registerHooks import came with commit 1184819cb (#7012, 2026-10-24). At least 18 files under scripts/ reference this loader (source-derived, from grep).

Reproduction

Run on Windows 11 x64 (10.0.26300):

  1. Fast-forwarded main to 570abe95f, then bun install (exit 0).
  2. bun scripts/generate-skill-metadata.mjs exits 1 with the error above.
  3. The chain bun scripts/clean-build-output.mjs && bunx --bun tsc -p tsconfig.build.json && bun scripts/record-catalog-digests.mjs && bun scripts/bundle-runtime.mjs && bun scripts/generate-skill-metadata.mjs: the first four steps exit 0, the last step fails as above.

Reproduced 3 of 3 attempts: Bun 1.4.4 (full chain and standalone) and Bun 1.4.3 (full chain, same error).
Not tested: other operating systems, other Bun versions, and Node.js.

Expected behavior

Unverified expectation: the build chain should complete under Bun, or the loader should report an explicit unsupported-runtime error instead of a link error. Reasons for the expectation: rea doctor output accepts Bun as a JavaScript runtime (runtime: "bun"), and the README documents Bun for global updates. I did not find a stated policy on whether build scripts must run under Bun.

Impact and scope

  • Observed: clean-build-output has already removed the previous dist/, and the last step never runs, so the generated skills/reverse-engineer-anything/ output is not regenerated.
  • Not run: the other scripts that reference the loader; their impact is unknown.
  • Not run under Bun: the test files that import registerHooks (tests/acceptance/cliFormattingCapacity.test.ts, tests/boundary/browser/domVerifierCleanup.test.ts, tests/boundary/browser/webBundleCoordinatorImports.test.ts, tests/boundary/cli/cliStartupImports.test.ts).
  • Frequency: 3 of 3 attempts.

REA version

rea --version prints 6.8.0. Source revision 570abe95f on main.

Runtime and platform

Bun 1.4.4 and Bun 1.4.3, Windows 11 x64. Under Bun 1.4.4, process.version is v26.3.0.

Target and artifact context

Not applicable.

Interface

Package or setup

Earliest failure stage

Setup (the build script fails while its module links).

Relevant output or evidence

Command actually run: bun scripts/generate-skill-metadata.mjs (exit 1, error above).
Source reference at 570abe95f: scripts/lib/verifier-source-loader.mjs:2 (import) and :112 (call). Introduced by 1184819cb.
Missing evidence: Node.js behavior was not checked here.

Analysis or suspected cause

Source-derived: module.registerHooks is a Node.js API, and Bun does not export it at the versions tested. The open upstream Bun issue oven-sh/bun#27369 ("Bun does not support module.registerHooks") matches the error. Hypothesis: the loader cannot link under Bun because the import is static. Proposed check: make the hook optional (feature detection or a dynamic import) and rerun the build chain under Bun.

Additional context

Originally created by @Ercaner1988 on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/7799 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Setup, packaging, or upgrade ### Observed behavior On `main` at `570abe95f` (REA 6.8.0), the build step `scripts/generate-skill-metadata.mjs` exits 1 under Bun before doing any work: ``` SyntaxError: Export named 'registerHooks' not found in module 'node:module'. Bun v1.4.4 (Windows x64) ``` `scripts/lib/verifier-source-loader.mjs` has a static import, `import { registerHooks, stripTypeScriptTypes } from "node:module";` (line 2), and calls `registerHooks(...)` at line 112. Bun fails when linking the module, so the whole script fails, not only the hook call. The `registerHooks` import came with commit `1184819cb` (#7012, 2026-10-24). At least 18 files under `scripts/` reference this loader (source-derived, from `grep`). ### Reproduction Run on Windows 11 x64 (10.0.26300): 1. Fast-forwarded `main` to `570abe95f`, then `bun install` (exit 0). 2. `bun scripts/generate-skill-metadata.mjs` exits 1 with the error above. 3. The chain `bun scripts/clean-build-output.mjs && bunx --bun tsc -p tsconfig.build.json && bun scripts/record-catalog-digests.mjs && bun scripts/bundle-runtime.mjs && bun scripts/generate-skill-metadata.mjs`: the first four steps exit 0, the last step fails as above. Reproduced 3 of 3 attempts: Bun 1.4.4 (full chain and standalone) and Bun 1.4.3 (full chain, same error). Not tested: other operating systems, other Bun versions, and Node.js. ### Expected behavior Unverified expectation: the build chain should complete under Bun, or the loader should report an explicit unsupported-runtime error instead of a link error. Reasons for the expectation: `rea doctor` output accepts Bun as a JavaScript runtime (`runtime: "bun"`), and the README documents Bun for global updates. I did not find a stated policy on whether build scripts must run under Bun. ### Impact and scope - Observed: `clean-build-output` has already removed the previous `dist/`, and the last step never runs, so the generated `skills/reverse-engineer-anything/` output is not regenerated. - Not run: the other scripts that reference the loader; their impact is unknown. - Not run under Bun: the test files that import `registerHooks` (`tests/acceptance/cliFormattingCapacity.test.ts`, `tests/boundary/browser/domVerifierCleanup.test.ts`, `tests/boundary/browser/webBundleCoordinatorImports.test.ts`, `tests/boundary/cli/cliStartupImports.test.ts`). - Frequency: 3 of 3 attempts. ### REA version `rea --version` prints 6.8.0. Source revision `570abe95f` on `main`. ### Runtime and platform Bun 1.4.4 and Bun 1.4.3, Windows 11 x64. Under Bun 1.4.4, `process.version` is `v26.3.0`. ### Target and artifact context Not applicable. ### Interface Package or setup ### Earliest failure stage Setup (the build script fails while its module links). ### Relevant output or evidence Command actually run: `bun scripts/generate-skill-metadata.mjs` (exit 1, error above). Source reference at `570abe95f`: `scripts/lib/verifier-source-loader.mjs:2` (import) and `:112` (call). Introduced by `1184819cb`. Missing evidence: Node.js behavior was not checked here. ### Analysis or suspected cause Source-derived: `module.registerHooks` is a Node.js API, and Bun does not export it at the versions tested. The open upstream Bun issue oven-sh/bun#27369 ("Bun does not support `module.registerHooks`") matches the error. Hypothesis: the loader cannot link under Bun because the import is static. Proposed check: make the hook optional (feature detection or a dynamic import) and rerun the build chain under Bun. ### Additional context - Related: #6953 (Bun runtime autonomy). Open PR #6923 changes the Bun runtime check, not this import. - Upstream Bun issue: https://github.com/oven-sh/bun/issues/27369
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4644
No description provided.