Which Version of Node.js Should You Use?
Update (November 16, 2023):
20.9.0 is preferred version offering long term support (LTS).
The 20.x series featuring LTS was initially released on 04/18/2023.
The active LTS start date was on 10/24/2023 and maintenance begins on 10/22/2024.
This version has an end-of-life date of 04/30/2026.
Update (February 16 2023):
18.14.0 is the preferred version offering long term support (LTS). While 19.6.0 represents the most current version, using the latest version with LTS is appropriate for most users.
The latest Node version...
Node.js 19 is the latest major version of Node. It was released in October 2022 and features a more updated version of the V8 engine (10.7). It includes other enhancements like using keepAlive by default with HTTP(s).
Does this mean you should use the latest version of Node? In production, the answer is NO. This is because the latest version of Node doesn't always guarantee reliability.
The "stable" version of Node.js
Also known as the "stable version", the latest version includes new features that may not be fully tested yet. Updates are made frequently to the stable version with new updates being released every few months.
While using the latest stable version is encouraged for testing and development, it can be less reliable since not everything has been fully tested or discovered with the latest updates.
As a result, dev teams will typically use the latest "stable" version for local testing and development but rely on an LTS version for production deploys.
What is an LTS version of Node.js?
A long term support (LTS) version of Node.js is a version intended for use in production environments. These versions guarantee at least 18 months of support and are regularly updated with bug fixes and performance enhancements. For example, the Node.js 18 will be supported until April 2025.
This makes LTS versions preferred to the latest "stable" version because they are more reliable and tested than the latest releases having more experimental (and untested) features.
It should be noted that major versions that are even numbers (14.x.x, 16.x.x, 18.x.x) are LTS versions while uneven major versions (13.x.x, 15.x.x, 17.x.x) are stable versions. The key difference to highlight is the length of time the version is supported.
For example, if you use the most current version of Node (19.6.0) you will only have 6 months after the next LTS release (20.0.0) before the version is no longer supported.
Does the Node.js version matter?
Yes. While you can use a stable version in production, it is highly recommended you only use LTS versions with production deploys.
With that said, using the most current version of Node isn't always a bad idea. If you are a larger enterprise that lives and dies on the reliability of your system then LTS versions definitely matter. If you are an independent developer or a startup then using stable versions of NodeJs may not be the end of the world when growing your product or solution.
Stable versions of Node can run in production and often the experimental features are protected behind feature flags. They just won't offer support or guarantee bug fixes for that particular version.
What is the most stable version of Node.js?
As of this writing, 19.6.1 is the most current version of Node.js.
As of this writing, 18.14.1 is the most recent LTS version recommended for most users.
Which version of Node.js is right for you?
For most users, downloading the LTS version of Node from the official site is sufficient. If you want to play around with the latest version then downloading the current edition is also probably fine.
Lean on the conservative side by using an LTS version of Node in production.
Yeah..but what about all these installers?
When visiting the official Node.js site for downloading Node, you'll notice a plethora of different options including different installers (Windows/Mac), Docker images, and source code.
Here is a sensible break down of all these different options. TLDR just use the installer for your OS for a quick and correct way to get going with Node.
Installer vs Binary?
Binaries are already compiled files that can run without any compile step. When you download the binary version of Node.js you are getting the already compiled result of compiling source code (AKA you don't get the source code just the runnable output).
Installers are programs that install the binaries and other dependencies for running the NodeJs platform. These specific installers will install the binaries and their dependencies for the OS they are run on (Windows,Mac,etc)
Installers should be sufficient for most use cases. Remember that installers install the same binaries at the end of the day and will include other dependencies you may still need for running the platform.
32 bit vs 64 bit?
Binaries and installers are available for both 32 bit and 64 bit systems. The difference between a 32 bit system and a 64 bit system is how much data the OS can store and handle.
Older versions of Windows and Linux run on 32 bit platforms while Mac OSX and newer versions of Windows run on 64 bit systems.
Chances are you'll want the 64 bit version :).
ARMv7 vs ARMv8?
The ARMv7 and ARMv8 are the 32 bit and 64 bit execution environments for Linux.
Node Version Manager
The Node Version Manager (NVM) is a utility for switching between different versions of Node locally. This can be useful if the default version of node installed with npm isn't the same as a project you are working on...
If you try to run a project built on a different version of Node interesting things can happen. Your experience may not be the same. NVM helps in this situation because it allows you to conveniently switch between Node installs.
What about Docker?
It should be noted, however, that Docker can quickly put this NVM practice to shame. By containerizing local development efforts, you can work off images having specific versions of Node installed (aka fixing the "works on my machine" problem). This presents an easy alternative to working with NVM for local development across different Node versions.