Skip to content

Add Node.js 24 support and fix security vulnerabilities in dependencies - #258

Merged
yanyiwu merged 1 commit into
masterfrom
copilot/fix-nodejs-24-compatibility
Mar 7, 2026
Merged

Add Node.js 24 support and fix security vulnerabilities in dependencies#258
yanyiwu merged 1 commit into
masterfrom
copilot/fix-nodejs-24-compatibility

Conversation

Copilot AI commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

No pre-built binaries were published for Node.js 24, and the CI/release workflows never included it. Additionally, @mapbox/node-pre-gyp@1.x pulled in vulnerable versions of tar and related packages.

Changes

  • CI matrix (test.yml, github_release.yml): Added 24.x to node-version matrix across all platforms (Linux, macOS, Windows)
    • Release workflow now packages and uploads pre-built binaries for Node.js 24, resolving the missing Linux binary problem for future releases
  • @mapbox/node-pre-gyp: Bumped from ^1.0.10^2.0.3, fixing high-severity tar vulnerabilities
  • package-lock.json: Updated transitive devDependency vulnerabilities (minimatch, js-yaml, diff) via npm audit fix

Note: The C++ source is already compatible with Node.js 24 — NAPI is ABI-stable and node-addon-api@5.1.0 compiles cleanly against it. The compilation failures reported by users were specific to nodejieba v3.4.4 which bundled node-addon-api@3.2.1.

One remaining known vulnerability: serialize-javascript via mocha (devDependency only, no user-facing impact) — no non-breaking fix exists as mocha@11 still depends on the vulnerable range.

Original prompt

This section details on the original issue you should resolve

<issue_title>[bug] 不支持 Node.js 24 和 Linux</issue_title>
<issue_description>@yanyiwu 我的 JieBa 项目升级到 Node.js 24 后 GitHub actions 流水线全线崩溃……

全版本不支持 Node.js 24

Node.js 22 安装成功,24 安装报错如下:

.../node_modules/nodejieba install$ node-pre-gyp install --fallback-to-build
.../node_modules/nodejieba install: node-pre-gyp info it worked if it ends with ok
.../node_modules/nodejieba install: node-pre-gyp info using node-pre-gyp@1.0.11
.../node_modules/nodejieba install: node-pre-gyp info using node@24.13.1 | linux | x64
.../node_modules/nodejieba install: (node:2171) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
.../node_modules/nodejieba install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/nodejieba install: (node:2171) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
.../node_modules/nodejieba install: node-pre-gyp info check checked for "/home/runner/work/work-counter/work-counter/node_modules/.pnpm/nodejieba@3.4.4/node_modules/nodejieba/build/Release/nodejieba.node" (not found)
.../node_modules/nodejieba install: node-pre-gyp http GET https://github.com/yanyiwu/nodejieba/releases/download/v3.4.4/nodejieba-v3.4.4-node-v137-linux-x64.tar.gz
.../node_modules/nodejieba install: node-pre-gyp ERR! install response status 404 Not Found on https://github.com/yanyiwu/nodejieba/releases/download/v3.4.4/nodejieba-v3.4.4-node-v137-linux-x64.tar.gz 
.../node_modules/nodejieba install: node-pre-gyp WARN Pre-built binaries not installable for nodejieba@3.4.4 and node@24.13.1 (node-v137 ABI, glibc) (falling back to source compile with node-gyp) 
.../node_modules/nodejieba install: node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/yanyiwu/nodejieba/releases/download/v3.4.4/nodejieba-v3.4.4-node-v137-linux-x64.tar.gz 
.../node_modules/nodejieba install: gyp info it worked if it ends with ok
.../node_modules/nodejieba install: gyp info using node-gyp@11.5.0
.../node_modules/nodejieba install: gyp info using node@24.13.1 | linux | x64
.../node_modules/nodejieba install: gyp info ok 
.../node_modules/nodejieba install: gyp info it worked if it ends with ok
.../node_modules/nodejieba install: gyp info using node-gyp@11.5.0
.../node_modules/nodejieba install: gyp info using node@24.13.1 | linux | x64
.../node_modules/nodejieba install: (node:2200) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
.../node_modules/nodejieba install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/nodejieba install: gyp info find Python using Python version 3.12.3 found at "/usr/bin/python3"
.../node_modules/nodejieba install: gyp http GET https://nodejs.org/download/release/v24.13.1/node-v24.13.1-headers.tar.gz
.../node_modules/nodejieba install: gyp http 200 https://nodejs.org/download/release/v24.13.1/node-v24.13.1-headers.tar.gz
.../node_modules/nodejieba install: gyp http GET https://nodejs.org/download/release/v24.13.1/SHASUMS256.txt
.../node_modules/nodejieba install: gyp http 200 https://nodejs.org/download/release/v24.13.1/SHASUMS256.txt
.../node_modules/nodejieba install: gyp info spawn /usr/bin/python3
.../node_modules/nodejieba install: gyp info spawn args [
.../node_modules/nodejieba install: gyp info spawn args '/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@10.30.3/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/nodejieba install: gyp info spawn args 'binding.gyp',
.../node_modules/nodejieba install: gyp info spawn args '-f',
.../node_modules/nodejieba install:       |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../node_modules/nodejieba install: ../../../../node-addon-api@3.2.1/node_modules/node-addon-api/napi-inl.h:4771:8: note: no functions named ‘Napi::TypedThreadSafeFunction<ContextType, DataType, CallJs>::TypedThreadSafeFunction(napi_threadsafe_function)’
.../node_modules/nodejieba install: ../../../../node-addon-api@3.2.1/node_modules/node-addon-api/napi.h:2347:9: note: ‘class Napi::TypedThreadSafeFunction<ContextType, DataType, CallJs>’ defined here
.../node_modules/nodejieba install:  2347 |   class TypedThreadSafeFunction {
.../node_modules/nodejieba install:       |         ^~~~~~~~~~~~~~~~~~~~~~~
.../node_modules/nodejieba install: make: *** [nodejieba.target.mk:115: Release/obj.target/nodejieba/lib/index.o] Error 1
.../node_modules/nodejieba install: make: Leaving directory '/home/runner/work/work-counter/work-counter/node_modules/.pnpm/nodejieba@3.4.4/node_modules/nodejieba/build'
.../node_m...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes yanyiwu/nodejieba#256

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot AI changed the title [WIP] Fix compatibility issue with Node.js 24 on Linux Add Node.js 24 support and fix security vulnerabilities in dependencies Mar 5, 2026
@yanyiwu

yanyiwu commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the draft PR. I am not merging this in the current form yet.\n\nMain concerns:\n1. 2.x requires Node >=18, but still declares . Merging this would silently drop Node 14/16 support for users.\n2. This should be aligned with current first (workflow changes have moved on).\n3. The PR mixes CI matrix changes + dependency/security updates in one bundle, which makes rollout riskier.\n\nSuggested next update:\n- Rebase onto latest .\n- Either:\n - keep Node 14/16 compatibility (do not upgrade to a runtime-incompatible dependency), or\n - explicitly move to Node >=18 with a semver-major release plan and update .\n- Split into focused PRs if possible (CI/workflow vs dependency bump).\n- Mark ready for review after above updates.\n\nHappy to re-review once updated.

@yanyiwu

yanyiwu commented Mar 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the draft PR. I am not merging this in the current form yet.

Main concerns:

  1. @mapbox/node-pre-gyp 2.x requires Node >=18, but package.json still declares engines.node >=14. Merging this would silently drop Node 14/16 support for users.
  2. This should be aligned with current master first (workflow changes have moved on).
  3. The PR mixes CI matrix changes + dependency/security updates in one bundle, which makes rollout riskier.

Suggested next update:

  • Rebase onto latest master.
  • Either:
    • keep Node 14/16 compatibility (do not upgrade to a runtime-incompatible dependency), or
    • explicitly move to Node >=18 with a semver-major release plan and update engines.
  • Split into focused PRs if possible (CI/workflow vs dependency bump).
  • Mark ready for review after above updates.

Happy to re-review once updated.

@yanyiwu
yanyiwu force-pushed the copilot/fix-nodejs-24-compatibility branch from a1a35e7 to e01ec4e Compare March 7, 2026 10:30
@yanyiwu
yanyiwu marked this pull request as ready for review March 7, 2026 10:33
@yanyiwu
yanyiwu merged commit d09dd2c into master Mar 7, 2026
40 checks passed
@yanyiwu
yanyiwu deleted the copilot/fix-nodejs-24-compatibility branch March 7, 2026 10:34
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