Migrating from Node.js 18 to Node.js 24 LTS
Why this matters
Node.js 18 reached end of life and no longer receives security patches. Running it in production means every new CVE in the runtime or bundled OpenSSL stays unpatched. Move directly to the current LTS rather than stepping through intermediate majors.
Known behavior changes on the way (18 -> 19 -> 20 -> 22 -> 24)
- DNS resolution results are returned verbatim instead of reordered (since 19).
- HTTP(S) keep-alive is enabled by default, which changes connection reuse behavior.
- Several crypto and url APIs deprecated in 18 have since been removed.
- The test runner and core APIs gained many options; older flags may behave differently. Treat this list as a starting point — the authoritative source is the official release notes for each major.
Migration steps
Step 1: Install Node.js 24
nvm install 24 && nvm use 24
node --version
Step 2: Clean rebuild of dependencies
rm -rf node_modules package-lock.json
npm install
Step 3: Rebuild native addons
Any node-gyp module compiled under 18 will not load under 24. A clean install rebuilds them; verify by starting the app and exercising the paths that use native modules:
npm rebuild
npm ls --depth=0
Step 4: Fix runtime deprecations
node --trace-deprecation --trace-warnings app.js
Step 5: Update CI and containers
Update the Node version in CI matrices and Docker base images so every environment matches.
Compatibility checklist
- Scan dependencies for packages that hard-pin Node 18 or test only against it.
- If you depend on very old native modules, check their maintained forks before upgrading.
- Re-run load tests: default keep-alive changes can affect socket counts and timeouts.