DEV Community

Cover image for How to Update Node.js Versions on Windows?
Lucy
Lucy

Posted on

How to Update Node.js Versions on Windows?

Node.js is a very popular runtime environment that allows developers to build scalable, high-performance applications using JavaScript. As technology evolves, it regularly releases updates that include new features, bug fixes, and security patches. To ensure better performance, stability, and compatibility with the latest packages, it is necessary to keep your version of Node.js up to date on Windows.

We will take you through several ways to update Node.js on Windows in this guide.

Why Update Node.js?

Prior to actually doing anything, let's briefly cover why it is important to update Node.js:

Security: Older versions can have vulnerabilities that are patched in newer versions.

Performance: Many new versions come with optimizations for improved speed.

Compatibility: The most current frameworks, libraries, and npn packages might require a newer version of Node.js.

Features: Each new version has added modern JavaScript features and APIs.

Different Methods to Update Node.js Version On Windows

Method 1: Update Using the Official Installer

The easiest and most dependable approach to upgrading Node.js is to download it from the official site.

  1. Go to the official Node.js download page.

  2. Choose the Windows Installer (.msi) corresponding to your system architecture (x64 or x86).

  3. Launch the installer and follow the instructions provided.

  4. Close and restart your terminal/command prompt.

  5. Confirm installation by running:

node -v 
Enter fullscreen mode Exit fullscreen mode

This should show the newly installed version.

Method 2: Update Node.js Using Node Version Manager (nvm-windows)

If you often have to switch between different versions of Node.js for your various projects, you should definitely consider using nvm for Windows.

  1. Remove existing Node.js version that was installed by the official installer.

  2. Download and install nvm-windows from nvm-windows releases.

  3. Run either Command Prompt or PowerShell and install another version of Node.js:

nvm install 20.11.1 
Enter fullscreen mode Exit fullscreen mode
  1. Set the default version:
nvm use 20.11.1 
Enter fullscreen mode Exit fullscreen mode
  1. Confirm the update:
node -v 
Enter fullscreen mode Exit fullscreen mode

With nvm-windows, you can install and manage multiple Node.js versions seamlessly.

Method 3: Update via Chocolatey

If you use the Windows package manager known as Chocolatey, you can update Node.js easily with one command.

  1. Make sure that you have Chocolatey installed.

  2. Run the following command in an elevated Command Prompt (Admin):

choco upgrade nodejs-lts 
Enter fullscreen mode Exit fullscreen mode

or for the current version:

choco upgrade nodejs 
Enter fullscreen mode Exit fullscreen mode
  1. Verify the update:
node -v 
Enter fullscreen mode Exit fullscreen mode

Method 4: Manual Update with Zip Archive

For developers who prefer manual control:

  1. Download the latest .zip archive from Node.js official site.
  2. Extract it to a folder (e.g., C:\Program Files\nodejs).
  3. Update your system environment variables to point to the new Node.js folder.
  4. Restart your system and verify the version.

Best Practice: Keep npm Updated Too

When updating Node.js, don’t forget to update npm (Node Package Manager).
Run:

npm install -g npm 
Enter fullscreen mode Exit fullscreen mode

This ensures your package manager also has the latest features and fixes.

Conclusion

Whether you want to use the official installer, nvm-windows, Chocolatey, or a manual installation, updating Node.js on Windows is easy. For most developers, nvm-windows provides the maximum flexibility, while the official installer is convenient for someone just looking for the latest stable version.

Updating your development environment ensures smoother development, current access to modern JavaScript features, and enhanced security. So take a moment to check your version, and update Node.js to keep your future development flowing.

If you’re looking to build scalable, high-performance applications. You can hire Node JS developer who are skilled in managing the latest versions, optimizing performance, and ensuring smooth integration with modern frameworks.

Top comments (0)