Skip to content

fix(node): enforce Frappe-compatible Node version before asset build#98

Open
umairsy wants to merge 1 commit into
frappe:mainfrom
umairsy:fix/node-version-enforcement
Open

fix(node): enforce Frappe-compatible Node version before asset build#98
umairsy wants to merge 1 commit into
frappe:mainfrom
umairsy:fix/node-version-enforcement

Conversation

@umairsy

@umairsy umairsy commented Jun 23, 2026

Copy link
Copy Markdown
Member

Problem

Building an app on a v16 bench fails with an opaque yarn error (engine "node" is incompatible ... Expected >=24. Got 14.8.0) when a stale Node is already on PATH.

Cause

install_node() only installed Node if not which("node"), so an existing old Node was never upgraded — and the get_app build path never ensured Node at all.

Fix

  • install_node() reinstalls when Node is missing or older than REQUIRED_NODE_MAJOR (24), and raises a clear, actionable error if it's still too old.
  • macOS: follow brew install with brew upgrade node to pass an old keg.
  • build_assets() / build_assets_for_app() ensure Node before building from source (prebuilt path untouched).
  • Tests for skip/upgrade/raise paths + nodesource-channel sync guard.

Getting/building an app on a bench whose Frappe needs Node >= 24 (v16)
failed with a cryptic, deep-stack yarn error ("engine 'node' is
incompatible ... Expected >=24. Got 14.8.0") whenever a stale Node was
already on PATH.

Root cause: install_node() only installed Node `if not which("node")`, so
an existing (old) Node was never upgraded; and the get_app build path never
ensured Node at all.

Fix:
- install_node() now (re)installs when Node is missing OR older than
  REQUIRED_NODE_MAJOR (24), and raises a clear, actionable error if a
  supported Node still isn't on PATH afterwards.
- macOS install follows `brew install` with `brew upgrade` to move past an
  older linked keg.
- build_assets() and build_assets_for_app() (the get_app path) now ensure a
  supported Node before building from source; the prebuilt-asset path is
  untouched.

Adds unit tests covering skip/upgrade/raise paths and a guard keeping the
nodesource channel in sync with REQUIRED_NODE_MAJOR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Aradhya-Tripathi

Copy link
Copy Markdown
Contributor

@umairsy thanks for the PR,

Can you somehow enforce this during init and only version checks during build (for backward compatibility) since ensure that node is installed during init.

("Install Node.js dependencies", python_env_manager.install_node_dependencies),

Also can you ask Claude to make the code less verbose 😄

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