How to install Node.js and verify the version

· Category: Node.js

Short answer

Download the LTS installer from nodejs.org for your operating system and run it. Open a terminal and run node -v and npm -v to confirm the installation.

Steps

  1. Visit the official Node.js website at https://nodejs.org and download the LTS (Long Term Support) version.
  2. Run the installer and follow the setup wizard. On Windows, this adds Node to your PATH automatically. On macOS, you can also use Homebrew with brew install node.
  3. On Linux, use your package manager or NodeSource distributions for the latest versions.
  4. Open a terminal or command prompt and type node -v to see the installed Node.js version.
  5. Type npm -v to verify the Node Package Manager is installed.

Tips

  • Use a version manager like nvm (Linux/macOS) or nvm-windows to switch between Node versions easily.
  • The LTS version is recommended for production applications because it receives security updates and bug fixes.

Common issues

  • node is not recognized usually means the PATH environment variable is missing the Node installation directory. Reinstall or add it manually.
  • On Linux, avoid installing Node solely from default repositories because they often contain outdated versions.