Raise Node.js Minimum to 20.20.2#1478
Conversation
There was a problem hiding this comment.
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.jsonengines 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 |
There was a problem hiding this comment.
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.
electron_demo/manipulator/README.md
Outdated
| - 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 |
There was a problem hiding this comment.
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).
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" |
There was a problem hiding this comment.
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.
| "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" |
There was a problem hiding this comment.
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.
| 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; | ||
| } |
There was a problem hiding this comment.
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.
| 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}` | ||
| ); |
There was a problem hiding this comment.
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.
This PR raises the minimum supported Node.js version to
20.20.2and includes the follow-up fixes from PR review.What changed
20.20.2.Tests
Validation
Fix: #1458