Programming & Coding How-TosTechnology

How to Check Which Node and npm Versions Are Installed

Admin
How to Check Which Node and npm Versions Are Installed

Before you follow any Node.js tutorial, install a new framework, or ask for help with an error, there is one small check you should always do first: confirm which versions of Node and npm are actually installed on your computer. Many confusing errors turn out to be nothing more than a version that is too old, too new, or missing entirely.

The good news is that checking takes less than a minute on any operating system. Two short commands give you the answers, and this guide shows exactly where to type them, how to read the results, and what to do when the commands do not work.

Quick Answer

Open a terminal or command prompt and run node -v to see the installed Node.js version and npm -v to see the npm version. The terminal prints a number such as v20.11.0 for Node and 10.2.4 for npm. If you get a message saying the command is not found or not recognized, Node is not installed or is not on your system path.

What Node and npm Versions Mean

Node.js is the runtime that lets JavaScript run outside the browser, on your computer or a server. npm is the package manager that comes with it, used to install libraries and tools. They are installed together, but they have separate version numbers and are released on separate schedules, which is why you should check both, not just one.

Version numbers follow a pattern of three parts: major, minor, and patch, such as 20.11.0. Tutorials and packages often state a minimum version, for example “requires Node 18 or higher.” Knowing your exact numbers lets you compare at a glance. Node also publishes long-term support releases, labeled LTS, which are the safest choice for most people because they receive fixes for an extended period.

Step-by-Step: Check on Any Computer

Step 1: Open a Terminal

  • Windows: Open Command Prompt, PowerShell, or Windows Terminal from the Start menu.
  • macOS: Open the Terminal app from Applications, then Utilities, or search for it with Spotlight.
  • Linux: Open your terminal application, often with the shortcut Ctrl + Alt + T.

Step 2: Check the Node Version

  1. Type node -v and press Enter. You can also use the longer form node --version, which gives the same result.
  2. Read the output. A reply like v20.11.0 means Node version 20.11.0 is installed and working.

Step 3: Check the npm Version

  1. Type npm -v and press Enter, or use npm --version.
  2. Read the output, such as 10.2.4. Note that npm version numbers do not start with a v in the output, which is normal.

You can confirm the recommended downloads and current release lines at the official Node.js download page, and compare your numbers with the versions offered there.

Checking Where Node Is Installed

Sometimes a computer has more than one Node installation, for example one installed directly and another added by a version manager or an editor tool. That can cause the strange situation where one terminal reports a different version than another.

To see which installation your terminal is actually using, run which node on macOS and Linux, or where node on Windows. The command prints the full file path of the Node program. If the path surprises you, it explains the version confusion, and you can decide which installation to keep. Developers who switch versions often use a version manager, and our guide on installing and managing Node.js and npm versions explains those tools in plain language.

Checking Versions Inside a Project

Knowing your global versions is only half the picture. Projects can declare the versions they expect inside the package.json file, in a field called engines. When a project lists, for example, Node 18 or higher, compare that requirement with your node -v result before installing dependencies.

Some projects also include a file named .nvmrc that records the exact Node version the team uses. Version manager tools can read that file and switch automatically. Even without those tools, opening the file shows you the expected version in one glance, which prevents a whole class of “works on my machine” problems when your version differs from the team’s.

What to Do When the Command Is Not Found

An error such as 'node' is not recognized on Windows or command not found: node on macOS and Linux means one of two things: Node is not installed at all, or it is installed but its folder is not on the system path that the terminal searches.

  1. If you never installed Node, download the LTS installer from the official site and run it, then close and reopen the terminal and try again.
  2. If you installed Node recently, reopening the terminal is often the whole fix, because the path is updated for new terminal sessions.
  3. If you installed it long ago and the error is new, reinstalling the LTS version cleanly is the fastest reliable repair.
  4. On a work computer, check whether you are using the right terminal profile, since some tools open their own shells with different paths.

The installation guides linked from the Node.js documentation pages cover each operating system if you need detailed help.

Common Mistakes and Useful Tips

  • Typing the command in the wrong place: These commands go in a terminal, not in a browser, a code file, or the Node interactive prompt after it has started. If you see a > prompt from Node itself, type .exit first, then run the command.
  • Confusing Node and npm numbers: They are different products with different versions. Reporting only one of them when asking for help often slows down the answer.
  • Skipping the check after an upgrade: Always run both version commands after installing or upgrading to confirm the new version is the one your terminal actually uses.
  • Using a very old version: Modern frameworks drop support for old Node releases. If your major version is well behind the current LTS line, plan an upgrade.
  • Tip: Inside the Node interactive mode, you can also print process.version to see the runtime version, which is handy when scripting checks.
  • Tip: Write your versions down when reporting a bug. “Node 20.11.0, npm 10.2.4, Windows 11” helps others reproduce your problem immediately.
  • Tip: Check versions on the server too, not just your own machine. A mismatch between local and server versions is a frequent source of deployment surprises.

Conclusion

Checking your Node and npm versions is a ten-second habit that prevents hours of confusion. Open a terminal, run node -v and npm -v, and compare the results with what your tutorial, project, or server expects. If the commands are not recognized, Node needs installing or the terminal needs reopening after an install. Make this the first step whenever a Node project behaves strangely, and you will solve a surprising number of problems before they really start.

Frequently Asked Questions

What is the command to check the Node version?

Run node -v in a terminal or command prompt. The longer form node --version prints the same information, a version number such as v20.11.0.

How do I check my npm version separately?

Run npm -v in the same terminal. npm has its own version number, separate from Node, even though it is installed together with Node and updated on its own schedule.

Why does my terminal say node is not recognized?

Node is either not installed, or its location is not on the system path. Install the LTS version from the official site, then close and reopen the terminal so it picks up the updated path.

Which Node version should I have installed?

For most people, the current LTS release is the best choice. It is stable, supported for a long time, and accepted by nearly all tutorials and frameworks. Avoid odd-numbered or very old major versions for daily work.

Can I have two Node versions on one computer?

Yes, usually through a version manager that lets you switch per project. Without such a tool, multiple manual installs often cause confusion about which one the terminal uses, so check the path with which node or where node.

Admin

Passionate about the intersection of style and storytelling. I simplify fashion trends and industry news into easy-to-follow advice, helping you stay stylish and informed in the fast-paced world of fashion.

Leave a Reply

Your email address will not be published. Required fields are marked *