How to Install Node.js on Your Local System

Node.js is a powerful JavaScript runtime built on Chrome’s V8 engine. It allows you to run JavaScript on the server side and is widely used for building scalable and high-performance web applications. Installing Node.js on your local system is the first step to getting started with building applications using JavaScript outside of the browser.
Here’s a step-by-step guide on how to install Node.js on your local machine.
Step 1: Download Node.js
- Visit the Official Website
- Go to the official Node.js website: https://nodejs.org.
- Choose Your Version
- You’ll see two main download options:
- LTS (Long Term Support): Recommended for most users as it is stable and receives security updates.
- Current: Contains the latest features, but may be less stable.
- For most users, LTS is the best choice.
- You’ll see two main download options:
- Download the Installer
- Download the appropriate version for your operating system:
- Windows:
.msi
file - macOS:
.pkg
file - Linux: Download the package for your Linux distribution or use a package manager.
- Windows:
- Download the appropriate version for your operating system:
Step 2: Install Node.js

For Windows
- Run the Installer
- Double-click the
.msi
file you downloaded.
- Double-click the
- Follow the Setup Wizard
- Click Next to continue through the installation steps. Accept the license agreement, choose the installation path, and make sure the option to add Node.js to your PATH is selected.
- Install npm (Node Package Manager)
- The Node.js installation automatically includes npm, which is the package manager used to install and manage packages in your Node.js applications.
- Complete the Installation
- Once the installation is complete, click Finish to exit the setup wizard.
For macOS

- Run the
.pkg
Installer- Double-click the
.pkg
file you downloaded.
- Double-click the
- Follow the Installation Steps
- The installer will guide you through the necessary steps. The default installation location is fine for most users.
- Verify Installation
- After the installation finishes, open Terminal and check if Node.js is installed by typing:
node -v
- This should display the version of Node.js that was installed.
- After the installation finishes, open Terminal and check if Node.js is installed by typing:
For Linux

- Using a Package Manager (e.g., Ubuntu)
- Open a terminal and first update your package list:
sudo apt update
- Install Node.js from the NodeSource repository (Recommended for the latest version):
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs
- You can also install Node.js from your system’s default package manager (though it may not be the latest version):
sudo apt install nodejs npm
- Open a terminal and first update your package list:
- Verify Installation
- Check the installed version of Node.js: code
node -v
- Check npm (Node Package Manager):
npm -v
- Check the installed version of Node.js: code
Step 3: Verify Node.js and npm Installation
After installation, you can verify that both Node.js and npm were installed successfully:
- Check Node.js Version
Open your terminal or command prompt and type:node -v
This will display the installed version of Node.js. - Check npm Version
To check the version of npm (Node Package Manager), run:npm -v
Step 4: Install a Simple Node.js Application
To verify that Node.js is working correctly, you can create a simple application.
- Create a New Directory
In your terminal, create a new folder for your project:mkdir mynodeapp cd mynodeapp
- Create a JavaScript File
Inside the project folder, create a file calledapp.js
:touch app.js
- Add Code to app.js
Open theapp.js
file and add the following code:console.log('Hello, Node.js!');
- Run the Application
In your terminal, run the app using Node.js:node app.js
If everything is set up correctly, you should see:Hello, Node.js!
Step 5: Install Global Packages with npm
Once Node.js and npm are installed, you can start installing various packages from npm to enhance your development process.
To install a package globally (for use in any project on your system), use the following command:
npm install -g <package-name>
For example, to install express (a popular Node.js web framework) globally:
npm install -g express

Step 6: Update Node.js and npm (Optional)
If you need to update Node.js or npm in the future, follow these steps:
- For Node.js
- On macOS or Linux, you can use the Node Source script to update Node.js:
sudo apt-get install -y nodejs
- For Windows, download and run the latest installer from the Node.js website.
- On macOS or Linux, you can use the Node Source script to update Node.js:
- For npm
You can update npm globally by running:npm install -g npm@latest
You’ve now successfully installed Node.js on your local system and are ready to begin building applications using JavaScript on the server side. Node.js, along with npm, provides you with all the tools you need to develop powerful web applications, APIs, and more.
If you want to learn more, there are many tutorials available online to help you dive deeper into Node.js development.
Happy coding!