Skip to content

fix(cli): import F_OK from fs.constants for Node ESM compatibility#3

Open
diwakar-s-maurya wants to merge 1 commit intomayfer:masterfrom
diwakar-s-maurya:fix/f-ok-esm-import
Open

fix(cli): import F_OK from fs.constants for Node ESM compatibility#3
diwakar-s-maurya wants to merge 1 commit intomayfer:masterfrom
diwakar-s-maurya:fix/f-ok-esm-import

Conversation

@diwakar-s-maurya
Copy link
Copy Markdown

@diwakar-s-maurya diwakar-s-maurya commented Mar 6, 2026

Summary

  • Node v25 removed F_OK as a direct named ESM export from node:fs, causing bunx pg-here and npx pg-here to crash with SyntaxError: The requested module 'node:fs' does not provide an export named 'F_OK'
  • Fix imports F_OK via fs.constants instead, which works on all Node versions from 18+

Test

Ran node scripts/cli-error-help.mjs 2>&1.

  • Verified on Node v18.20.8 — no errors
  • Verified on Node v22.22.1 (LTS) — no errors
  • Verified on Node v24.13.1 — no errors
  • Verified on Bun 1.3.10 — no errors

`F_OK` is not available as a direct named ESM export from `node:fs`.
Import it via `constants.F_OK` instead, which works on Node 18+.
@timothyjoh
Copy link
Copy Markdown

Please approve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants