Skip to content

Fail fast with a clear error on unsupported Node.js and remove hard-coded node#135

Merged
krassowski merged 6 commits into
jupyterlab:mainfrom
Darshan808:fix-warnings-on-older-nodejs
Jul 3, 2026
Merged

Fail fast with a clear error on unsupported Node.js and remove hard-coded node#135
krassowski merged 6 commits into
jupyterlab:mainfrom
Darshan808:fix-warnings-on-older-nodejs

Conversation

@Darshan808

Copy link
Copy Markdown
Member

Fixes #127

Description

@rspack/core v2 is ESM-only and requires Node >=20.19 or >=22.12. On older Node versions, the build previously failed with a cryptic ERR_REQUIRE_ESM error. Now we check the current Node version against rspack's own engines.node requirement before spawning Node and raise a clear, actionable error instructing users to upgrade.

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just a suggestion on the error message

Comment thread jupyter_builder/federated_extensions.py Outdated
Darshan808 and others added 2 commits June 29, 2026 07:31
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the build experience when users run jupyter-builder with an unsupported Node.js version by checking the local Node.js version against @rspack/core’s engines.node requirement and failing early with a clear, actionable error message (instead of a later ERR_REQUIRE_ESM failure).

Changes:

  • Add _read_rspack_node_range() and _check_node_version() and call the check before spawning the builder in both build_labextension() and watch_labextension().
  • Add tests covering reading @rspack/core’s Node range and the version-check pass/fail behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
jupyter_builder/federated_extensions.py Adds Node version range discovery + fail-fast validation before running the JS builder.
tests/test_core_path.py Adds unit tests for reading @rspack/core Node engine range and enforcing it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jupyter_builder/federated_extensions.py Outdated
Comment thread tests/test_core_path.py Outdated
Comment thread jupyter_builder/federated_extensions.py
Comment thread jupyter_builder/federated_extensions.py
Darshan808 and others added 2 commits July 1, 2026 14:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Darshan808 Darshan808 changed the title Fail fast with a clear error on unsupported Node.js Fail fast with a clear error on unsupported Node.js and remove hard-coded "node" Jul 1, 2026
@Darshan808 Darshan808 changed the title Fail fast with a clear error on unsupported Node.js and remove hard-coded "node" Fail fast with a clear error on unsupported Node.js and remove hard-coded node Jul 1, 2026

@krassowski krassowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, let's try it

@krassowski krassowski merged commit be13a2c into jupyterlab:main Jul 3, 2026
23 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in CFP '25 tracking Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Show useful message when user tries to build using unsupported Node.js version (rather than ERR_REQUIRE_ESM)

3 participants