feature_image_How-to-update-NodeJS-and-NPM-to-the-latest-versions
Home » Blog » NPM » How to update NodeJS and NPM to the latest versions

How to update NodeJS and NPM to the latest versions

Updated:   NPM 1 min read

Your support helps keep this blog running! Secure payments via Paypal and Stripe.


Lately, I have been working on the Vue.js project. I installed NodeJS and NPM before, but now I want to update them to the latest version. This post will show how.

On modern setups, npm and npx are tied to Node.js:

  • npx is bundled inside npm.
  • npm versions are released in step with newer Node.js versions.

So if your Node.js is too old, the newest npm version simply won’t run on it. That’s why the update failed.

Note

👉 Update Node.js first (to the latest LTS), and npm/npx will automatically update to versions that are fully compatible.

Update npm (Node Package Manager)

If you just want to update only npm, follow the steps below.

  1. Check your current npm version
    Open your terminal and run: npm -v
  2. Install the latest npm version globally npm install -g npm@latest
  3. Verify the update
    Run the version check again to confirm the upgrade: npm -v

Update Node.js

If you are trying to update npm and the update fails, you will need to update NodeJS instead.

On Windows

  • Simply go to the official Node.js website and download the LTS (.msi installer).
  • Run the installer—it’ll detect and upgrade your existing installation.
  • After installation, verify with: node -v

On macOS or Linux

  1. Check your Node.js version: node -v
  2. Install the n module globally using npm: sudo npm install -g n
  3. Upgrade Node.js using n:
    • To get the latest version: sudo n latest
    • For the most stable release: sudo n stable
  4. Confirm the update: node -v

Hope this helps! If you’d like to show your support, you can buy me a coffee.


Your support helps keep this blog running! Secure payments via Paypal and Stripe.


Senior WordPress & WooCommerce Developer

Senior WordPress & WooCommerce Developer

I’m a professional WordPress and WooCommerce developer based in Chiang Mai, Thailand, with over a decade of experience creating fast, secure, and scalable websites. From custom themes and plugins to full WooCommerce stores, I help businesses build a strong and reliable online presence. Need a developer you can count on? View my portfolio or get in touch to discuss your project.