How to Install Node.js and npm on Windows or macOS
Installing Node.js and npm on Windows or macOS is an easy task. Learn how to do it within a few minutes.
What are Node.js and npm?
How to Install Node.js and npm
Step 1: Download and Run the Node.js Installer
First, you have to download the installer. Navigate to:
Click the Windows Installer or macOS Installer button. This starts downloading the latest, recommended Node.js version for Windows / macOS. Once the installer has finished downloading, you are ready to run it. So, browse to the location where you have saved the file and run the installer.
The installer will guide you through the steps. You can leave it with the defaults. When the installer has finished the installation, you are ready to use Node.js. Let's verify that everything works as intended in the next step.
Step 2: Verify Your Node.js Installation
After running the installer for Node.js, you should have access to the
node and the
npm command-line-utilities. Let's try it! Open the Windows Command Prompt / Windows PowerShell or Terminal (macOS). Enter the following:
Now, you should see the current Node.js version installed on your system. Let's try the same for npm:
This should show you the current npm version on your system. If everything works, you are ready to create your first simple Node.js program. If you see an error, try restarting your computer. Then, try again.
Step 3: Create Your First Node.js Program
Now, save that file and name it
hello.js. Open your Windows Command Prompt / PowerShell or Terminal (macOS).
Use it to navigate to the place where you've saved the file. Then, type in the following:
You should see
Have fun learning! See you around!