- Now: October 2023, we have Node.js 18.18.0 LTS and 20.7.0 (current)
- Going to drop Node.js 16 support before its end-of-file 2023-09-11 in Metarhia codebase, all projects, and course examples
- Now we can rely on Node.js 18.18.0 capabilities
- See release schedule: github.com/nodejs/release#release-schedule
- Before this one see also previous checklist "Drop Node.js 14": github.com/tshemsedinov/Drop-Nodejs14
- New node.js uses
OpenSSL 3
instead ofOpenSSL 1.1.1
. This led to an early end of support for Node.js 16 LST: September 11th, 2023. See details: nodejs.org/en/blog/announcements/nodejs16-eol
- Due to the move from
npm v9
or later version, convertpackage_lock.json
tolockfileVersion 3
by command:npm i --lockfile-version 3
- Run your project with flag
--pending-deprecation
to see deprecation warnings and then with flag--throw-deprecation
to exit with non-zero on deprecated API calls - Use native Fetch API instead of polyfill like
undici
ornode-fetch
. Now you can avoidaxios
andrequest()
fromnode:http
- You can use Web Streams API to be compatible with browser API in server-side rendering or so
- Use
Buffer
method.subarray(start, end)
instead of deprecated.slice(start, end)
: see Buffer docs - Stop using deprecated
url.parse
: see DEP0169 docs - Stop using deprecated
Thenable
in streams: see DEP0157 docs - Use http events:
dropRequest
anddrop
: see http docs - Use
server.closeAllConnections()
andserver.closeIdleConnections()
: see http docs - Use
module.isBuiltin(moduleName)
: see module docs - Now we can use new
V8
features: - Use promise-based
node:readline
API, example:const name = await rl.question('Name:');
and new methods:clearLine
,commit
androllback
,cursorTo
,moveCursor
, classInterface
- Do not use
node:async_hooks
API likecreateHook
andAsyncHook
as non-stable, except stable classesAsyncLocalStorage
andAsyncResource
, see docs in a separate article "async context tracking"
- Stable Web Crypto API (
globalThis.crypto
orrequire('node:crypto').webcrypto
) - Improvements to the Intl API
- Class
Blob
fromnode:buffer
- Class
BrodcastChannel
fromnode:worker_threads
- Global function
structuredClone
- Class
v8.GCProfiler
- Now
child_process.fork
supportsfile:
protocol
- Now we have native test runner module:
node:test
but it is not completely ready in all aspects. By the waynode:test
is a first module available just withnode:
prefix, it means: you can't access it byrequire('test')
- Single executable applications
- Both experimental module-based and process-based permission model
- Experimental
--watch
flag to enable auto-restart on changes - Experimental Web Streams API
- Experimental method subprocess[Symbol.dispose] added in node.js 20.5.0 to send
SIGTERM
to spawned child process - Experimental class
File
- Experimental classes
TracingChannel
,CustomEvent
,CompressionStream
,CustomEvent
- Use native Fetch API instead of npm modules
undici
,request
,axios
,node-fetch
- See previous recommendations for removing third-party dependencies in favour of node.js internal modules
- See 100 NodeJS Interview Questions
- See Node.js 2023 course index
- See free Node.js lectures index