To verify Node.js installation, run node -v or node –version. This checks if Node.js is installed and working correctly.
Problem
Before you run any Node.js application or install packages, make sure Node.js and npm is installed in your machine.
Solution
You can check if Node.js is installed using the following terminal commands:
Step 1: Check Node.js Version
bash
If Node.js is installed, this will return a version like:
Step 2: Check npm (Node Package Manager) Version
bash
If npm is installed, this will return a version like:
If You See an Error
If it returns something like command not found or ‘node’ is not recognized, then Node.js is not installed.
Bonus Tip
You can also check both at once using:
bash
Conclusion
Verifying Node.js and npm installation is the first step in any Node project. Always check both before you start development.