Node.js must be installed on your computer before you can execute JavaScript programs using Node.js.
In this lesson, we will learn how to download Node.js, install it on Windows, and check whether the installation was successful.
Open your browser and visit the official Node.js website.
Website: https://nodejs.org/
Download Node.js only from the official website to reduce the risk of downloading an unsafe installer.
The Node.js website provides release options. For most beginners, the LTS (Long-Term Support) release is a good choice because it receives long-term maintenance and is generally suitable for learning and regular development.
Choose the current LTS release displayed on the official Node.js website. The version number may change over time.
If you are using Windows, select the Windows installer provided on the official download page.
.msi file
for Windows.
After downloading the installer, follow these steps:
After installation, open Command Prompt on Windows.
Windows + R.cmd.You can also search for Command Prompt in the Windows Start menu.
Type the following command and press Enter:
node -v
This command displays the version of Node.js installed on your computer.
v22.15.0
This is only an example. Your installed version may be different.
NPM is installed along with the standard Node.js Windows installer. To check its version, run:
npm -v
This command displays the installed version of NPM.
10.9.2
The displayed version may differ depending on the Node.js release installed on your computer.
Now that Node.js is installed, let's create a simple JavaScript file.
Create a folder named MyNodeProject.
Inside the folder, create a file named app.js.
console.log("Node.js is installed successfully!");
Open Command Prompt in your project folder and run:
node app.js
Node.js is installed successfully!
This can happen if Node.js is not installed correctly or its installation directory is missing from the PATH environment variable.
Try these steps:Restart the terminal and check your installation. If the error continues, verify that the Node.js installation directory and the NPM command directory are configured correctly.
node -v.npm -v.MyNodeProject.app.js file inside the folder.console.log().node app.js.1. Which website should you use to download Node.js?
2. Which command checks the Node.js version?
3. Which command runs the app.js file?