Skip to content

Raise Node.js Minimum to 20.20.2#1478

Merged
minggangw merged 4 commits intoRobotWebTools:developfrom
minggangw:fix-1458-1
Apr 8, 2026
Merged

Raise Node.js Minimum to 20.20.2#1478
minggangw merged 4 commits intoRobotWebTools:developfrom
minggangw:fix-1458-1

Conversation

@minggangw
Copy link
Copy Markdown
Member

@minggangw minggangw commented Apr 7, 2026

This PR raises the minimum supported Node.js version to 20.20.2 and includes the follow-up fixes from PR review.

What changed

Tests

Validation

npx mocha test-native-loader.js test-prebuilds.js

Fix: #1458

Copilot AI review requested due to automatic review settings April 7, 2026 07:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Raises the project’s minimum supported Node.js version to 20.20.2 as part of the Lyrical-readiness roadmap (Issue #1458), aligning package metadata, CI coverage, and user-facing docs/demos with the new floor.

Changes:

  • Update documentation and demo prerequisites to Node.js >= 20.20.2.
  • Update package.json engines and prebuild target to 20.20.2.
  • Move the Linux ARM64 CI build-and-test lane to Node 20.20.2.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ts_demo/topics/README.md Update TypeScript topics demo Node.js prerequisite to 20.20.2.
ts_demo/services/README.md Update TypeScript services demo Node.js prerequisite to 20.20.2.
ts_demo/actions/README.md Update TypeScript actions demo Node.js prerequisite to 20.20.2; minor markdown cleanup.
tools/jsdoc/tmpl/mainpage.tmpl Update JSDoc homepage install guidance to Node 20.20.2+.
scripts/npmjs-readme.md Update npm README prerequisites and prebuilt matrix Node.js floor to 20.20.2.
README.md Update repo README prerequisites and prebuilt matrix Node.js floor to 20.20.2.
package.json Bump prebuild target and engines.node to >= 20.20.2.
electron_demo/topics/README.md Update Electron topics demo Node.js prerequisite to 20.20.2.
electron_demo/manipulator/README.md Update manipulator demo Node.js prerequisite to 20.20.2; minor markdown cleanup.
electron_demo/car/README.md Update car demo Node.js prerequisite to 20.20.2; minor markdown cleanup.
docs/BUILDING.md Update build-from-source docs Node.js minimum to 20.20.2.
benchmark/README.md Update benchmark docs Node.js minimum to 20.20.2.
.github/workflows/linux-arm64-build-and-test.yml Pin ARM64 CI lane to Node 20.20.2.

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

### Prerequisites

- [Node.js](https://nodejs.org/en/) version >= 16.13.0
- [Node.js](https://nodejs.org/en/) version >= 20.20.2
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The repository-wide minimum Node.js version is being raised here, but electron_demo/turtle_tf2/README.md still states "Node.js: Version 18 or higher". This leaves inconsistent prerequisites across docs/demos; update that demo README (and any other remaining references) to match the new >= 20.20.2 floor.

Copilot uses AI. Check for mistakes.
Comment on lines 309 to 311
- This demo uses Electron 31.7.7 for rclnodejs compatibility
- Electron 38+ requires C++20, which rclnodejs doesn't support yet
- The current versions are tested and stable
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

This troubleshooting section claims the demo uses Electron 31.7.7 and that Electron 38+ requires C++20, but electron_demo/manipulator/package.json now declares electron: ^40.1.0. Please reconcile the README with the actual dependency/version support policy (either update the documented Electron version/constraints or adjust the dependency).

Copilot uses AI. Check for mistakes.
package.json Outdated
"prepare": "husky",
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"prebuild": "prebuildify --napi --strip --target 16.20.2 --target electron@23.0.0 && node scripts/tag_prebuilds.js"
"prebuild": "prebuildify --napi --strip --target 20.20.2 --target electron@23.0.0 && node scripts/tag_prebuilds.js"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

npm run prebuild builds both a Node target and an Electron target, but scripts/tag_prebuilds.js renames all generated .node files to the same {ros}-{ubuntu}-{arch}-rclnodejs.node name. When multiple outputs exist (e.g., node vs electron), this can overwrite nondeterministically and publish the wrong binary. Consider splitting Node/Electron prebuild steps, or include the runtime/ABI in the tagged filename and update install logic accordingly.

Suggested change
"prebuild": "prebuildify --napi --strip --target 20.20.2 --target electron@23.0.0 && node scripts/tag_prebuilds.js"
"prebuild:node": "npx rimraf ./prebuilds ./prebuilds-node && prebuildify --napi --strip --target 20.20.2 && node scripts/tag_prebuilds.js && node -e \"require('fs').renameSync('prebuilds', 'prebuilds-node')\"",
"prebuild:electron": "npx rimraf ./prebuilds ./prebuilds-electron && prebuildify --napi --strip --target electron@23.0.0 && node scripts/tag_prebuilds.js && node -e \"require('fs').renameSync('prebuilds', 'prebuilds-electron')\"",
"prebuild": "npm run prebuild:node && npm run prebuild:electron"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Comment on lines +20 to +40
function detectPrebuildRuntime() {
if (process.env.npm_config_runtime === 'electron') {
return 'electron';
}

return process.versions.electron ? 'electron' : 'node';
}

function getTaggedPrebuildFilename({
rosDistro,
ubuntuCodename,
arch,
runtime,
}) {
return `${rosDistro}-${ubuntuCodename}-${arch}-${runtime}-${PREBUILD_PACKAGE_NAME}.node`;
}

function getRuntimeFromGeneratedPrebuild(fileName) {
const runtime = fileName.split('.')[0];
return SUPPORTED_PREBUILD_RUNTIMES.has(runtime) ? runtime : null;
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The new prebuild naming helpers are central to install/prebuilt resolution, but there are no unit tests validating runtime detection or filename parsing/formatting (e.g., that generated prebuild names like node.napi.node/electron.napi.node are correctly recognized, and that tagged filenames include the runtime segment). Adding focused tests would help prevent regressions that could break install-time or runtime native loading.

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +81
const candidate = getTaggedPrebuildFilename({
rosDistro,
ubuntuCodename,
arch,
runtime,
});
const candidatePath = path.join(prebuildDir, candidate);

if (fs.existsSync(candidatePath)) {
debug(`Found ${runtime} prebuilt binary: ${candidate}`);
return require(candidatePath);
}

debug(`No exact match found for: ${exactMatchFilename}`);
debug(
`No matching ${runtime} prebuilt binary found for ${rosDistro}-${ubuntuCodename}-${arch}`
);
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

customFallbackLoader() now incorporates runtime into the tagged prebuild filename it searches for. The existing native-loader tests only assert that the path contains humble and rclnodejs.node, so they won’t catch regressions where the runtime segment is missing/incorrect (or where node/electron binaries get mixed). Please extend the existing test to assert that the candidate path includes the expected -node- or -electron- runtime segment based on detectPrebuildRuntime() behavior.

Copilot uses AI. Check for mistakes.
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 7, 2026

Coverage Status

coverage: 85.368% (-0.04%) from 85.411% — minggangw:fix-1458-1 into RobotWebTools:develop

@minggangw minggangw merged commit b83aa44 into RobotWebTools:develop Apr 8, 2026
16 checks passed
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.

Roadmap: Prepare rclnodejs for ROS 2 Lyrical Luth

3 participants