Skip to content

Pin nuxt-app to Node 22 to fix Vercel ERR_REQUIRE_ESM - #174

Merged
denbec merged 1 commit into
mainfrom
denbec/fix-vercel-node22
May 6, 2026
Merged

Pin nuxt-app to Node 22 to fix Vercel ERR_REQUIRE_ESM#174
denbec merged 1 commit into
mainfrom
denbec/fix-vercel-node22

Conversation

@denbec

@denbec denbec commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

The security-fix lockfile regen (#173) pulled isomorphic-dompurify forward to 2.36, which transitively brings in jsdom@28html-encoding-sniffer@6@exodus/bytes (ESM-only). That CJS-to-ESM require() only works on Node 22.12+ or 20.19+; Vercel was honoring .nvmrc=v20 and running an older Node 20, producing ERR_REQUIRE_ESM at function startup and serving 404s.

Bumps nuxt-app/.nvmrc to v22 (matching the rest of the stack — Directus Dockerfile, CI workflows, setup.sh — that I aligned in #171 but missed this file). Adds engines.node >=22.12.0 so future installs and Vercel deploys can't silently regress.

Test plan

  • Vercel build picks up Node 22 from .nvmrc and deploys successfully
  • Live site no longer 404s; SSR functions don't crash with ERR_REQUIRE_ESM

🤖 Generated with Claude Code

The security-fix lockfile regen pulled isomorphic-dompurify forward to
2.36, which transitively brings in jsdom@28 → html-encoding-sniffer@6
→ @exodus/bytes (ESM-only). The CJS-to-ESM require there only works
on Node 22.12+ or 20.19+. Vercel was honoring .nvmrc=v20 and running
an older Node 20, producing ERR_REQUIRE_ESM at function startup.

Bumps .nvmrc to v22 and adds an engines.node constraint so future
installs/deploys can't silently regress.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
programmierbar-website Building Building Preview, Comment May 6, 2026 0:45am

Request Review

@denbec
denbec merged commit 983964a into main May 6, 2026
1 of 2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a028ef9077

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread nuxt-app/package.json
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=22.12.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin Vercel's engine range to Node 22

When this Vercel project deploys from nuxt-app, >=22.12.0 is an open-ended range that also matches Node 24, so it does not actually pin the runtime to Node 22. Vercel's Node-version docs say engines.node overrides project settings and their examples map broad ranges like >=20.0.0 to the latest 24.x version, while only 22.x/^22.0.0 map to latest 22.x; with 24.x currently available, this can deploy the SSR functions on Node 24 instead of the intended Node 22 and reintroduce untested runtime behavior despite the .nvmrc change.

Useful? React with 👍 / 👎.

denbec added a commit that referenced this pull request May 6, 2026
PR #174 only landed the .nvmrc bump and engines.node addition; the
follow-up commits that contained the real fix never made it in, so
the runtime is still hitting ERR_REQUIRE_ESM at startup. This applies
that follow-up cleanly on top of main.

The security PR's lockfile regen pulled isomorphic-dompurify forward
to 2.36, which transitively brings in jsdom@28 → @exodus/bytes
(ESM-only). Vercel's serverless runtime (/opt/rust/nodejs.js) does
not implement Node 22.12+'s require(esm) interop, so the CJS-to-ESM
require crashes there even on Node 22.

Pins isomorphic-dompurify to ~2.20.0 — the version that was deployed
and working before the security PR. jsdom resolves naturally to
26.1.0 (CJS, pre-@exodus/bytes), so the runtime require chain stays
CJS-only. Audit count remains 0.

Also tightens engines.node from ">=22.12.0" to "^22.12.0" to keep
deploys on Node 22.x (and off any future Node 24+).

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@Jan0707 Jan0707 mentioned this pull request Aug 4, 2026
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.

1 participant