Node.js v22 Enters Long Term Support (LTS)
On October 29, 2024,* Node.js v22 officially transitioned into *Long Term Support (LTS) with the codename 'Jod'. For developers and organizations relying on the stability of Node.js for production environments, this transition marks a key milestone for Node.js 22.x, ensuring it will receive critical updates and security support for years to come. Let’s take a closer look at what this means, along with a refresher on the Node.js release lifecycle 🔄.
I believe the transition to LTS makes this release line more stable, especially given the improvements made over 10 releases. This line now offers a wealth of features, providing a mature and reliable option for production use -Rafael Gonzaga, Principal OSS Engineer at NodeSource
Understanding the Node.js Release Lifecycle
The Node.js release lifecycle is designed to provide a balance between innovation and stability, allowing developers to explore new features while maintaining the confidence that production applications will have the longevity of support they need. Here’s a breakdown of each stage:
- Current Release: Each new major version of Node.js starts in the "Current" phase, a six-month period in which the community can test new features, APIs, and performance improvements. During this phase, library maintainers and developers are encouraged to adopt new features, providing valuable feedback. The "Current" release is updated frequently, helping the community prepare for the latest advancements in Node.js.
- Active LTS: After the Current phase, Node.js releases undergo a divergence based on version number. Odd-numbered releases (e.g., v21) enter unsupported status, while even-numbered releases (e.g., v22) transition to Active LTS status. In this phase, which typically lasts one year, the Node.js version is deemed stable and ready for production use. This period includes patches for bugs, critical fixes, and security updates. It is the most widely used phase for Node.js releases in production environments.
- Maintenance LTS: After the Active LTS period concludes, a Node.js release enters the Maintenance LTS phase. This phase, lasting approximately 18 months, focuses on essential bug fixes and security patches. No new features are introduced during this time, which helps to ensure stability for production applications. Maintenance LTS is the final phase before a version reaches the end of its lifecycle.
- End of Life (EOL): After Maintenance LTS, a Node.js version reaches End of Life (EOL), meaning it will no longer receive official support or updates from the Node.js project. Users running EOL versions are encouraged to upgrade to supported versions to maintain security and receive the latest patches.
Node.js typically maintains three active release lines simultaneously. This includes one Current version, one Active LTS version, and one Maintenance LTS version. By keeping a mix of releases in each phase, the Node.js team provides a structured progression of stability while supporting a range of user needs across different environments.
Node.js v22.11.0 "Jod" (LTS): What’s New?
Now that we understand the Node.js Life Cycle, let’s see what’s new on the latest LTS. With Node.js v22.11.0, the 22.x release line has officially moved into Active LTS. The release includes an update to metadata, like the process.release
object, to reflect this new LTS status. Let’s look at some key highlights of Node.js v22:
1. Built-in WebSocket Client
A significant development in Node.js v22 is the built-in WebSocket client, now enabled by default for browser compatibility. Previously, developers had to rely on third-party libraries for WebSocket functionality, but with Node.js v22, the process is streamlined. Developers can now open bidirectional communication channels between client and server without external dependencies, paving the way for efficient real-time application development.
2. Stable Watch Mode
Previously marked as experimental, the Watch Mode feature is now stable in Node.js v22. Developers can use --watch
to monitor files and automatically restart processes on changes, eliminating the need for third-party tools like nodemon. This addition can significantly boost productivity during development by reducing manual restarts.
3. ESM Graphs in require()
Working with ECMAScript Modules (ESM) in Node.js has often required intricate workarounds, especially when integrating with CommonJS modules. Node.js v22 simplifies this by allowing the import of entire ESM graphs using require()
through the --experimental-require-module
option. This feature provides smoother module interoperability, making it easier to develop modular, maintainable code without complex dependencies.
4. Simplified Script Execution with --run
An experimental --run
flag has been added to execute scripts directly from package.json
, providing a faster alternative to npm run
for frequently used commands. This feature allows quicker access to scripts without the overhead of loading npm, making it particularly useful for routine testing and debugging.
5. V8 Engine Upgraded to Version 12.4
With the V8 engine update to version 12.4, Node.js v22 introduces a range of advanced capabilities:
- WebAssembly Garbage Collection improves memory handling for WebAssembly applications.
- New JavaScript Functions: Array.fromAsync() for asynchronous array generation, new Set methods, and iterator helpers give developers powerful new tools.
- High Watermark Increase: The default high watermark for streams has been raised from 16 KB to 65 KB, boosting performance for memory-intensive applications, though developers working with limited memory can adjust it as needed.
These upgrades further enhance Node.js’s ability to support modern JavaScript applications with robust performance and efficient memory management.
6. Pattern Matching with glob
and globSync
In this release, Node.js introduces pattern-matching capabilities to the node:fs
module through glob
and globSync
. These new methods simplify file system operations by allowing developers to search and manipulate files based on specific patterns, streamlining tasks like organizing files or managing directory structures.
7. Optimized AbortSignal Creation
Node.js v22 enhances AbortSignal creation performance, which directly benefits high-level APIs that utilize this class, including fetch
and the Node.js test runner. This improvement ensures that applications relying on these APIs can now execute more efficiently, especially in performance-sensitive environments.
Is particularly exciting how Node.js v22 fills some long standing gaps by incorporating features that truly deserve to be part of the core runtime. The inclusion of a built-in WebSocket client and the stabilization of Watch Mode are game-changers. These additions eliminate the need for external libraries and tools that developers have relied on for years to perform essential tasks. The ‘Jod’ release not only streamlines the development process but also enhances performance and security. It's a significant step forward that reflects the project's commitment to evolving based on the real needs of its user community -Adrian Estrada, VP of Engineering at NodeSource
Why Move to Node.js 22.x?
As Node.js v22 moves to LTS status, it becomes an attractive option for long-term projects and production environments. The simplified module handling, and built-in tools make it a robust choice for developers looking to build scalable, modern applications. If you’re considering an upgrade, now is an ideal time to explore Node.js v22’s capabilities and prepare for its benefits in a stable, supported environment.
For developers and businesses on older Node.js versions, Node.js v22 now presents a compelling choice. Its Active LTS phase means it’s ready for production, with a guaranteed support timeline, critical security updates, and enhanced functionality. Here’s why it might be worth considering an upgrade:
- Extended Support: Node.js v22 will remain in Active LTS until October 2025, providing a full year of active support before it transitions to Maintenance LTS, which will continue until April 2027.
- Stability for Production: The LTS phase is carefully managed to minimize risk, with a focus on bug fixes and security patches rather than new features. This makes Node.js v22 a safe and stable choice for production applications.
Node.js v20 is now in maintenance mode, which means, no features will land there anymore (except security releases).
How to Upgrade to Node.js 22.x
For organizations and developers ready to migrate to Node.js v22.x, here are some best practices to keep in mind:
- Test Your Application: Before rolling out any major upgrade, thoroughly test your application in a staging environment. Node.js v22.x introduces certain performance optimizations and under-the-hood improvements, so it's essential to confirm compatibility with your codebase and any dependencies.
- Update Dependencies: Make sure all libraries and dependencies are compatible with Node.js v22.x. Check for deprecations or breaking changes, especially if you're coming from an older LTS version.
a. You can update your dependencies for Linux using NodeSource N|Solid & Node.js Binary Distributions
b. For most developers, especially on Unix-based systems, nvm provides the easiest upgrade path, you can run:
nvm install 22 nvm use 22
c. For MacOS you can instal Node.js via Homebrew:brew update brew upgrade node
d. Downloading from the Official Node.js Site: https://nodejs.org/en - Monitor Performance: After upgrading, monitor application performance to ensure that your application continues to function optimally. Node.js v22.x comes with improved diagnostics and performance, but monitoring will help catch any unforeseen issues early. Use N|Solid to get the deepest, most valuable performance and security telemetry in production to help you resolve issues faster. We are working on the “State of Node.js Performance 2024” which will show the performance difference between v20 and v22, keep an eye on the NodeSource blog to not miss it.
- Follow Best Practices for Security: Node.js v22’s improves security, but it’s still important to implement additional security measures, such as enforcing HTTPS and using secure coding practices.
The N|Solid Runtime supports the latest LTS version. Download it now for free here.
Final Thoughts
The release of Node.js v22.11.0 as an LTS version represents another significant step in the evolution of the Node.js platform, particularly for developers and organizations seeking stability and security. With Active LTS support extending into late 2025, and a Maintenance phase until April 2027, Node.js v22.x is an excellent choice for those aiming for long-term support in production environments.
The transition of Node.js 22.x into LTS highlights the Node.js project’s ongoing commitment to providing a secure, reliable platform for the global developer community. For those on earlier Node.js versions, now is an ideal time to consider upgrading to Node.js v22.x and benefiting from its extended support period.
Stay tuned for updates on future releases, as Node.js continues to deliver powerful tools and capabilities to meet the needs of an ever-evolving tech landscape. Use N|Solidto monitor Node.js 22.x performance.
Looking for advanced or enterprise support for Node.js? NodeSource is the premier provider, trusted by organizations like Delta, Visa, and Kaiser, to ensure robust support for their Node.js platforms. Partner with us to keep your applications secure, performant, and reliable.