<!-- PkgPulse AI-readable guide source -->
<!-- Canonical: https://www.pkgpulse.com/guides/nodejs-24-to-26-migration -->
<!-- Raw Markdown: https://www.pkgpulse.com/guides/nodejs-24-to-26-migration/raw.md -->
<!-- Source path: content/guides/nodejs-24-to-26-migration.mdx -->

---
title: "Node.js 24 to 26 Migration Guide"
description: "Upgrade Node.js services to the next LTS. Check CI images, native addons, module loading, and real HTTP responses before you roll out the new runtime."
date: "2026-12-04"
author: "PkgPulse Team"
tags: ["migration", "runtime upgrades", "continuous integration"]
tier: 1
tileSubjects:
  - slug: nodejs-runtime
    name: Node.js
---

<!-- content-block--tldr -->
<!-- pipeline:claim c001 -->

Move a Node.js 24 service to Node.js 26 when the target deployment image can install the existing lockfile, load the app's dependencies and pass the same request and worker tests. Start with Node.js 24.23.0 as the baseline and 26.14.0 as the candidate. Keep your service on the patched Maintenance LTS line while a required platform or dependency still blocks the upgrade. The target is on Active LTS. [Node.js release index](https://nodejs.org/dist/index.json) · [Release schedule](https://github.com/nodejs/Release/blob/main/schedule.json)

## Pin the runtime that runs the service

<!-- pipeline:claim c002 -->
<!-- pipeline:claim c003 -->

Use the Node.js patch from your version manager, container image or hosting runtime. Check `node --version` inside the build job and again in the running service. Record `npm --version` wherever you install dependencies. The official distributions for both patches tested here ship npm 11.21.3. Your image or CI setup can supply a different npm. [Node.js 24.23.0 release](https://nodejs.org/en/blog/release/v24.23.0) · [Node.js 26.14.0 release](https://nodejs.org/en/blog/release/v26.14.0)

The npm package named `node` is a wrapper that installs a platform-specific Node.js binary. Its registry downloads measure that distribution channel. A version change to that dependency affects the environments that use its binary. Check the executable selected by your CI runner and your deployment separately. [Registry record for the npm wrapper](https://registry.npmjs.org/node/26.14.0)

Build the same commit in separate jobs, using the same lockfile and install options on both patches. If the project uses npm, run `npm ci` in each job. Use a clean dependency directory in the target image. If you cache installed dependencies, include the runtime, OS, architecture and libc in the cache key. Keep the first comparison small by retaining the same base OS and package manager where possible. If the new image also changes the OS or libc, record that change and test the exact image you will ship. [npm clean install reference](https://docs.npmjs.com/cli/v11/commands/npm-ci/)

The baseline needs more than a green build. Start the built service with its deployment command, send a request across the same kind of HTTP or queue interface production uses and record the expected result. Include a route that loads a native dependency or a module on demand if your app has one. For configuration pins, match the mechanism your repo already uses. [Version managers and CI pins](/guides/fnm-vs-nvm-vs-volta-nodejs-version-managers-2026)

## Quick decision table

<!-- pipeline:claim c004 -->
<!-- pipeline:claim c005 -->
<!-- pipeline:claim c006 -->

| What breaks on the target | What to check first | What to rerun |
|---|---|---|
| CI passes but deployment fails to start | Check the executable in the final image, the production entry command and any runtime flags. Check that your host offers the target runtime for your deployment type. | Start the final artifact and exercise readiness and a real application route. |
| A native dependency fails at install or load | Check whether the package has a matching prebuild for the target platform or can build from source there. Check `process.versions.modules` for addons tied to the Node module ABI. | Fresh install, actual import and an operation in the deployment image. |
| A route fails with `writeHeader` missing | Change the `ServerResponse.writeHeader()` call to `writeHead()`. Check transitive callers when the stack points into a dependency. | Compare status, headers and body over HTTP. |
| A module import fails for `_stream_passthrough` | Import `PassThrough` from `node:stream`. Review any other legacy `_stream_*` imports for their public equivalents. | Run the affected entry point and exercise the stream with a real chunk. |
| A TypeScript script stops on `--experimental-transform-types` | Use a build step or a compatible TypeScript runner if the script needs transforms for syntax such as enums. Remove the flag from the launch command once the replacement runs the script. | Start with the exact command used by CI or production. |
| Tests pass locally but fail in CI | Compare the test command, discovered files, setup hooks and emitted module format. Check the runner's support for the target runtime. | Run the existing suite in both jobs and compare the tests that executed. |

## Migration notes for native addons and module loading

The module ABI reported by the official binaries changed from 137 to 147. An addon built against the old Node module ABI can fail to load. An addon that uses Node-API exclusively can retain binary compatibility across majors when the target supports its Node-API version and the build matches the deployment platform. A prebuilt artifact can still rely on a particular libc or an external shared library. Check the package's published artifacts and load the installed binding inside the target image. Use the [native addon tooling guide](/guides/node-gyp-vs-prebuild-vs-napi-rs-native-nodejs-addons-2026) to identify how your package gets its binary. [Node.js process versions](https://nodejs.org/download/release/v26.14.0/docs/api/process.html#processversions) · [Node-API ABI stability](https://nodejs.org/download/release/v26.14.0/docs/api/n-api.html#implications-of-abi-stability)

Keep your module format during the runtime trial. Start the compiled app through the same entry point as production and exercise any branches that load dependencies on demand. If a removed built-in is the first failure, change the import or upgrade the package that owns it. If the failure comes from a CommonJS `require()` of an ES module, check the exact module graph. `require()` can load synchronous ES modules, while an ES module graph with top-level `await` needs asynchronous loading. Run the consumer through its real entry point after changing that call. [Node.js module loading reference](https://nodejs.org/download/release/v26.14.0/docs/api/modules.html#loading-ecmascript-modules-using-require)

Node.js 26 removed `--experimental-transform-types`. A local enum script printed its expected value with that flag on the baseline. The candidate rejected the flag before the script ran. If your scripts use it through a wrapper or `NODE_OPTIONS`, check the expanded command and test the replacement with the same script. [Node.js removal notes](https://nodejs.org/en/blog/release/v26.0.0)

## Reproduce a request regression and its fix

<!-- pipeline:claim c007 -->
<!-- content-block--evidence -->

Save this as `service.test.cjs`. It uses the built-in test runner and opens a loopback connection. Legacy mode uses the removed HTTP response alias and stream module. Fixed mode uses their public replacements. The HTTP handler in this fixture reports the exception type in its response so the failed test identifies the problem. [Node.js removal notes](https://nodejs.org/en/blog/release/v26.0.0) · [Built-in test runner](https://nodejs.org/download/release/v26.14.0/docs/api/test.html)

```js
const assert = require('node:assert/strict')
const { once } = require('node:events')
const { createServer } = require('node:http')
const { test } = require('node:test')

const legacy = process.env.MIGRATION_MODE === 'legacy'

test('GET /ready sends JSON over HTTP', async (t) => {
  const server = createServer((request, response) => {
    if (request.url !== '/ready') {
      response.writeHead(404).end()
      return
    }

    const sendHeaders = legacy ? 'writeHeader' : 'writeHead'
    try {
      response[sendHeaders](200, { 'content-type': 'application/json' })
      response.end(JSON.stringify({ ready: true }))
    } catch (error) {
      response.writeHead(500).end(error.name)
    }
  })

  t.after(() => new Promise((resolve, reject) => {
    server.close((error) => error ? reject(error) : resolve())
  }))
  server.listen(0, '127.0.0.1')
  await once(server, 'listening')

  const result = await fetch(`http://127.0.0.1:${server.address().port}/ready`)
  const body = await result.text()
  assert.equal(result.status, 200, `Response body: ${body}`)
  assert.equal(result.headers.get('content-type'), 'application/json')
  assert.deepEqual(JSON.parse(body), { ready: true })
})

test('the stream import can pass a chunk through', async () => {
  const PassThrough = legacy
    ? require('_stream_passthrough')
    : require('node:stream').PassThrough
  const stream = new PassThrough()
  stream.end('ready')
  const chunks = []
  for await (const chunk of stream) chunks.push(chunk)
  assert.equal(Buffer.concat(chunks).toString(), 'ready')
})
```

Run these commands in a POSIX shell with the baseline patch selected, then repeat with the target patch. No install is needed for the fixture.

```sh
MIGRATION_MODE=legacy node --trace-deprecation --test --test-reporter=tap service.test.cjs
MIGRATION_MODE=fixed node --trace-deprecation --test --test-reporter=tap service.test.cjs
```

| Runtime (official Linux x64 binary) | Legacy code | Fixed code |
|---|---|---|
| Node.js 24.23.0 | The response returns HTTP 200 with the JSON header and body. The stream passes the chunk. | Both tests pass. |
| Node.js 26.14.0 | The request returns HTTP 500 with `TypeError`. The stream import fails with `MODULE_NOT_FOUND`. | Both tests pass. |

A startup probe could miss both failures if the service runs that handler and loads that module only after receiving a request. Use the same approach with a route your users need, or a job that actually reads and writes data. The fixture covers a loopback HTTP request and a stream operation on Linux x64. Verify your own dependencies, image and hosting setup separately.

## Roll out the tested artifact

<!-- pipeline:claim c008 -->

Keep your existing test runner in the migration and run it on both patches. Check that the candidate ran the same test files and setup paths. Then run the production entry command, exercise a real request and verify a worker can process a representative job if your service has workers. Use a staging dependency when the case would otherwise write production data.

Keep the previous image or release artifact available. Promote the candidate to a small share of traffic once the deployment image passes, then check the same error rates, request latency and job outcomes you recorded for the baseline. If a canary fails those checks, restore the previous artifact and fix the failing case before trying again. If the platform still blocks the target image or runtime, keep patching the baseline and preserve the candidate job so you can retest when support arrives.

## Related guides

- [Plan an upgrade for a service on an older Node.js release](/guides/nodejs-22-vs-nodejs-20-upgrade-guide)

## Source notes

<!-- pipeline:source s001 -->
<!-- pipeline:source s002 -->
<!-- pipeline:source s003 -->
<!-- pipeline:source s004 -->
<!-- pipeline:source s005 -->
<!-- pipeline:source s006 -->
<!-- pipeline:source s007 -->
<!-- pipeline:source s008 -->
<!-- pipeline:source s009 -->
<!-- pipeline:source s010 -->
<!-- pipeline:source s011 -->
<!-- pipeline:source s012 -->

- [Node.js release index](https://nodejs.org/dist/index.json), [release schedule](https://github.com/nodejs/Release/blob/main/schedule.json), and the [baseline](https://nodejs.org/en/blog/release/v24.23.0) and [target](https://nodejs.org/en/blog/release/v26.14.0) release notes.
- [npm wrapper registry record](https://registry.npmjs.org/node/26.14.0) and [npm clean install reference](https://docs.npmjs.com/cli/v11/commands/npm-ci/).
- [Node.js major release notes](https://nodejs.org/en/blog/release/v26.0.0), [HTTP alias deprecation record](https://nodejs.org/download/release/v26.14.0/docs/api/deprecations.html#dep0063-serverresponseprototypewriteheader) and [stream module deprecation record](https://nodejs.org/download/release/v26.14.0/docs/api/deprecations.html#dep0193-requirenode_stream_).
- [Process versions](https://nodejs.org/download/release/v26.14.0/docs/api/process.html#processversions), [Node-API ABI stability](https://nodejs.org/download/release/v26.14.0/docs/api/n-api.html#implications-of-abi-stability), [module loading reference](https://nodejs.org/download/release/v26.14.0/docs/api/modules.html#loading-ecmascript-modules-using-require) and [built-in test runner](https://nodejs.org/download/release/v26.14.0/docs/api/test.html).
