How To Update Node Versions Using Mac, Windows, and Linux

Download Now: Introduction to JavaScript Guide
Jamie Juviler
Jamie Juviler


Node.js is one of the most popular JavaScript runtime environment platforms, allowing developers to build server-side applications using JavaScript. Like any software, keeping your Node version up to date is, in my experience, critical for optimal security and performance.

person learning how to update node JS on a laptop

Download Now: An Introduction to JavaScript  [Free Guide]

This post will show you how to update Node.js on Mac, Windows, and Linux. We'll also give some tips to make the process as smooth as possible. But first, we’ll cover why updating Node is so essential.

If you’re new to Node.js, I recommend brushing up on JavaScript first — check out our free intro guide to JavaScript, and then come back here.

Why is it important to keep Node up-to-date?

Node.js is an open-source platform. New features, bug fixes, and security updates are released regularly. Newer versions of Node.js will have:

  • Better security: Node.js updates patch known security vulnerabilities, so an outdated version of node leaves your application open to attacks.
  • New features: Having the latest version of Node.js means access to new features you can leverage in your application.
  • Better performance: Newer versions of Node.js run more efficiently, execute programs faster and more smoothly, fix bugs, and/or use less memory. This ultimately makes for a better experience using your application.

We know it’s important to update Node, so how do you actually update it? Let's look at updating Node on Mac, Windows, and Linux.

How to Update Node on Mac and Windows

There are a few ways to update Node on Mac and Windows. We'll talk about using npm or manually downloading the latest version and installing it yourself.

Using npm

You may already have Node Package Manager (npm) installed on your device. (If not, follow this guide to install npm.)

Here’s how to update Node using npm:

  1. Open the terminal and check your current Node version with the following comment:
    node -v
  2. Clear the npm cache with the command:
    npm cache clean --force
    This reduces the chance of any problems occurring during the update.
  3. Install n package with the command:
    npm install -g n
    This command will install n, which is npm’s Node version manager that you can use to update Node easily.
  4. To update Node to the latest version, use the following command:
    n latest
    This will install the latest version of Node on your system.
  5. Verify that your update is complete by rechecking your Node version:
    node -v

You can also run this command to check if any installed packages are outdated. If there are any, it will list them:

npm outdated

Manual download

You can also manually download the latest Node version from the official website. Once you’ve downloaded the package, follow the instructions to install the package. From there, you should be able to run the command node -v to verify that the latest stable version of Node is installed.

I’ve found that, while this method works, it’s typically more convenient to have npm installed on your device already (for a myriad of other reasons besides updating Node) so you can update by entering a couple of commands into the terminal.

How to Update Node Versions on Linux

The process of updating Node on Linux is a bit different from how it‘s done on Windows and Mac. You’ll need to use a package manager such as nvm or APT.

Using nvm

nvm (Node Version Manager) is a tool that allows you to manage multiple versions of Node on your system. You can use nvm to install, update, and switch between different versions of Node.

To update your version of Node using nvm, do the following:

  1. Check if you already have nvm installed on your system:
    nvm --version
  2. If it's not installed, install nvm using this command:
    curl -o- | bash
  3. Once nvm is installed, check your current version of Node by running the following command:
    node -v
  4. Update your version of Node using the following command:
    nvm install node --reinstall-packages-from=node
  5. Verify that your update is complete by rechecking your Node version:
    node -v

Using apt:

apt (Advanced Package Tool) is a package manager for Debian-based Linux distributions such as Ubuntu and Debian. To update Node using apt, do the following:

  1. First, check your current version of Node by running the following command:
    node -v
  2. Then run this command to install the latest version of Node:
    sudo apt-get install nodejs
  3. And finally verify that your update is complete by rechecking your Node version:
    node -v

These are just a few ways to update Node on Mac, Windows, and Linux. Keep in mind that it's important to keep current with the latest version of Node not only for security reasons but also to get access to new features and bug fixes.

Tips to Upgrade Node.js to the Latest Version

Stay updated on Node releases.

There’s no built-in way to notify you when new Node versions are released. So, keep an eye on the Node release notes for new updates or software changes. Here are some ways to stay in the know about these:

  • The latest version will always be available on the Node website, with changes detailed on the Node.js blog. You can check these resources regularly.
  • Consider subscribing to a Node newsletter like Node Weekly.
  • Since Node.js is open source, you can also watch the Node GitHub repository for updates to the package.
  • You can follow Node on X or LinkedIn where they post about new releases.

Plan to update regularly.

I recommend setting regular reminders to check for Node releases, even small ones, and update when appropriate. In cases of minor updates, updating your version immediately isn’t always necessary. However, for major releases and significant security patches, you’ll thank yourself that you’re on top of updates and reducing your app’s vulnerability.

Use a node version manager.

Many developers would recommend using a node version manager (nvm), which lets you switch between node versions quickly.

As WordPress developer Ahsan Ijtiba shares, “To maintain and update a Node.js app in web development, using a version manager like Node Version Manager (nvm) or fnm is highly recommended. These tools allow you to install multiple versions of Node.js and switch between them as needed, ensuring that you can work with different versions without conflicts.”

Review the changelog before updating.

Node.js is a foundational component of any application that uses it — it’s like changing the engine on your car — so any compatibility issue with your application has the potential to break things.

The Node.js blog publishes posts for each new release that detail improvements. Review this documentation before installing new package versions to learn about any deprecated features or possible breaking changes that might affect your application.

Test new releases.

Test new features or bug fixes in a development environment and test suite before deploying them to production. It isn’t a given that your program will always work as intended post-update, so this helps to ensure that everything functions properly before making any changes live.

Deploy the update gradually.

Often called a “canary release” (alluding to the phrase “canary in a coal mine”), the practice of gradually releasing software to a small subset of users before introducing it to the entire user base is a common method to mitigate risk. If an application malfunction occurs as a result of a Node.js update, this practice contains the damage and gives you time to address the issue before a wider rollout.

Monitor the update rollout.

Even after a gradual rollout, continue to monitor your application’s performance for unexpected behavior using Application Performance Monitoring tools, staying aware of any negative user feedback, and monitoring your application for unusual website metrics (e.g., lower-than-usual signup rates on a membership-based application) — all of these could signal a problem tying back to a Node update.

Check the community.

You may want to consult other developers for feedback on Node.js releases through GitHub or forums. Others have likely identified potential issues before you have, and can advise whether or not updating Node is ideal at the current moment.

Keeping Node Updated

From its easy-to-use environment, modern features, and constant updates, Node is a popular choice for developing applications. Keeping your version of Node updated is important to get the best performance, security, and features out of it. With multiple options available such as Mac, Windows, and Linux, updating Node is accessible and can be done quickly with a few steps.

New Call-to-action

Topics: Javascript

Related Articles

Learn more about one of the world's most popular programming languages.

    CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience