Matomo Analytics

Documentation

How do I upgrade my Node.js version?

Node.js releases move fast and older versions reach end-of-life quickly, so it's a good idea to keep your server on a current LTS release. This guide...

Node.js releases move fast and older versions reach end-of-life quickly, so it's a good idea to keep your server on a current LTS release. This guide upgrades the system-wide Node.js version installed through NodeSource.

Start by logging into SSH and login as the root user.

Run the following commands, replacing 22 with the major version you want (use a current LTS release such as 22 or 24):

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

NodeSource replaces any previously installed Node.js version, so this upgrades an existing install in place.

Verify the active version:

node -v

If you use a process manager such as PM2, restart your apps so they pick up the new Node.js binary.

Dennis Smink

Written by Dennis Smink

Dennis brings over 13 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Ready to dive in?
Start your free trial today.

Create an account and enjoy your 5-day free trial — no credit card required.

Start your free trial