Node.js Knowledge Patch
Use this skill when upgrading, reviewing, debugging, or writing modern Node.js applications, tooling, tests, native integrations, or build configurations.
How to use this skill
- Determine the exact Node.js version used by the project or deployment.
- Read the quick references below for high-impact migrations.
- Open only the topic references relevant to the task.
- Respect exact batch attribution: later patch and minor releases sometimes restore, revert, or tighten earlier behavior.
- Feature-detect where a reference says support can be omitted from custom builds or differs by crypto backend.
Reference index
| Reference | Read for |
|---|---|
| CLI, Configuration, SEA, and Releases | Startup flags, JSON and environment configuration, watch mode, single executables, and release cadence |
| Cryptography and Compression | WebCrypto, classic crypto, post-quantum algorithms, OpenSSL, Zstandard, Brotli, and zlib |
| Diagnostics and Performance | Inspector, diagnostic channels and reports, profiling, heap statistics, and performance monitoring |
| Filesystem, Buffers, and Streams | Filesystem APIs, buffers, globs, file URLs, Node streams, and Web streams |
| Modules, TypeScript, and WebAssembly | ESM, CommonJS, loader hooks, built-in TypeScript, WebAssembly, and compile caches |
| Native Addons, Embedding, and Builds | Node-API, addon ABI changes, embedders, FFI, source builds, and platform baselines |
| Networking, HTTP, and TLS | TCP, UDP, DNS, proxies, HTTP, HTTP/2, TLS, QUIC, certificates, and block lists |
| Processes, Workers, Async Context, and Permissions | Permission Model, processes, signals, workers, async context, cloning, and Web Locks |
| Runtime and Web Platform | Runtime semantics, deprecations, globals, events, URLs, readline, and general Web APIs |
| SQLite | node:sqlite connections, statements, sessions, functions, extensions, and query helpers |
| Testing and Assertions | node:test, mocking, snapshots, coverage, reporters, reruns, and deep comparison |
Breaking changes and migrations
Node.js 26 application migrations
- Replace
response.writeHeader()withresponse.writeHead()and replace private_stream_*imports with publicnode:streamAPIs. - Stop passing
--experimental-transform-types. Extensionless files inside a package with"type": "module"now follow ESM interpretation. - Do not assume a readable combines buffered chunks: reads now return one buffered chunk at a time.
- Pass
authTagLengthwhen creating a decipher for a short GCM tag. - Prefer
module.registerHooks()when synchronous hooks fit; dedicated-threadmodule.register()now emits a runtime deprecation warning. - Add
node_api.hexplicitly when an addon uses the full Node-API surface;node.hnow includes onlynode_api_types.h.
Node.js 25 application and toolchain migrations
- Install Corepack separately when a project depends on it; distributions no longer include it.
- Replace top-level filesystem access-mode aliases with
fs.constants, usefs.rm()instead of recursivefs.rmdir(), and close file handles explicitly. - Replace
SlowBufferwithBuffer.allocUnsafeSlow(), avoidassert.CallTracker, use the single-messageassert.fail()form, and await the promise returned byworker.terminate(). - Use the public child-process
channelproperty instead of_channel. - Replace RSA-PSS
hashandmgf1Hashoptions withhashAlgorithmandmgf1HashAlgorithm; specify XOFoutputLengthexplicitly. - Replace
response.writeHeader()withwriteHead()and use valid, explicit hostnames, TLS server names, and ports.
Node.js 24 application migrations
- Start the Permission Model with
--permission; the removed--experimental-permissionspelling no longer works. - Use
fs.ftruncate()for file descriptors. Usefs.constantsfor access modes, and replace removedDirent.pathreads withparentPath. - Replace
url.parse()and the deprecated string form ofurl.format()with the WHATWGURLAPI. - Do not pass an empty child-process
shell; omit it or supply a valid shell. - Call
node:httpclasses withnewor use their documented factories. - Stop depending on HTTP/2 priority signaling or
options.selectPadding.
Node.js 23 behavior changes
- Distinct
WeakMapandWeakSetinstances no longer compare deeply equal. - An out-of-bounds
Buffer.prototype.write()offset now throws. - Negative or
NaNtimer delays warn, andstream.pipeline()rejects a closed or destroyed destination. - Replace
crypto.fipswithcrypto.getFips()andcrypto.setFips(); replacefs.Dirent.pathwithparentPath. - Remove startup reliance on retired global-experiment opt-outs,
--trace-atomics-wait, and--experimental-default-type.
High-value version transitions
Test completion and TypeScript discovery
Node.js 24.0 made test() and t.test() stop returning completion promises,
but 24.3 restored those promises and reverted automatic subtest waiting. Await
subtests when sequencing their completion.
The TypeScript discovery glob changed in 23.10 and was rolled back in 24.1. Projects adapted to the intervening behavior should verify which tests run.
Built-in TypeScript
stripTypeScriptTypes()provides programmatic stripping.- Supported
.tsexecution became enabled by default while still experimental, then type stripping became stable. - Unsupported syntax has the dedicated
ERR_UNSUPPORTED_TYPESCRIPT_SYNTAXerror. .ctsimports use the synchronous CommonJS loader.
Module hooks and ESM
module.registerHooks()installs synchronousresolveandloadhooks in the current thread and coversrequire(),import, andcreateRequire().- Synchronous
require(ESM)is stable, with--require-moduleand--no-require-modulecontrols. import.meta.mainidentifies a directly run ES module.import deferpostpones static-module evaluation until its namespace is used.- Native-addon ESM imports are enabled by default.
Permission Model
- An entry point receives implicit read permission.
- Active permission flags propagate to spawned Node.js processes.
- Network and inspector grants use separate
--allow-netand--allow-inspectorcontrols. - Pipe connections, pipe opening, and pipe mode changes are checked against the network scope.
- Symlink operations require both filesystem-read and filesystem-write grants;
futimesand laterFileHandle.utimes()are disabled under permissions. - Audit mode reports denied access without throwing and uses distinct warning codes.
Core HTTP proxies and connection lifetime
- Core
http,https, and fetch clients can use proxy environment variables; custom agents acceptproxyEnv. http.setGlobalProxyFromEnv()enables environment proxy handling at runtime.server.keepAliveTimeoutBufferextends the server socket timeout, whileagentKeepAliveTimeoutBuffershortens the client reuse window.shouldUpgradeCallback()filters incoming HTTP upgrades before the'upgrade'handler.ServerResponse.writeInformation()sends arbitrary informational responses.
SQLite defaults and query APIs
- Foreign keys are enabled by default, and double-quoted string compatibility is disabled; use single quotes for SQL string literals.
- SQLite defensive mode later became the default. Change it explicitly when an application needs the earlier policy.
- Connections support read-only mode, busy timeouts, connection-wide bigint reads, online backups, custom scalar and aggregate functions, and loadable extensions.
- Sessions are public and disposable; tagged-template stores bind interpolated values and cache prepared statements.
SQLTagStore.sizeis a property, not a method.- Custom Node.js builds may omit SQLite, so code targeting those builds must
feature-detect
node:sqlite.
Files, buffers, and streams
- A
Bufferbacked by a resizableArrayBufferfollows the buffer's resized length, and the defaultBuffer.poolSizeis now 64 KiB. FileHandle.readableWebStream()always creates a byte stream and can close its handle withautoClose: true.Readable.toWeb()can create readable byte streams for BYOB consumers.stream.compose()is stable, and half-open duplex streams remain half-open during async iteration.node:vfsroutes mounted filesystem operations but is not a security boundary.
Crypto and compression
- Use
SubtleCrypto.supports()before selecting newer algorithms on nonstandard builds. - Key encapsulation, Argon2, and modern WebCrypto algorithms are available; later releases promote Argon2 and encapsulation/decapsulation to stable.
- Post-quantum PKCS#8 imports require seed-bearing private-key encodings, and later ML-KEM and ML-DSA exports default to seed-only encodings.
- Zstandard supports dictionaries; later decompression rejects truncated input
and accepts
ArrayBufferdictionaries. rejectGarbageAfterEndrejects trailing compressed data, and Web decompression streams reject trailing gzip members.
Diagnostics, profiling, and tests
- CPU and heap profiling can be enabled through supported startup options, and workers expose per-worker CPU usage plus CPU and heap profile handles.
- Inspector network tooling progressively covers HTTP, Undici, WebSocket, and HTTP/2 traffic and bodies.
- Test runs support global setup, per-test timeouts, object-property mocking, file snapshots, failure reruns, expected failures, tags, ambient contexts, and test-authored log events.
- Suite-level failures set a non-zero process exit code, and failed-test reruns preserve retry failures.