How to Install Node on Windows, macOS and Linux
In this tutorial, we'll learn how to install Node.js and NPM on Windows, macOS and Linux, in this step-by-step guide. By the end of it, you will have a valid installation of Node and NPM.
What is Node?
Node is an open-source JavaScript runtime built using Google's V8 JavaScript engine, the same one that powers Chromium and the Chrome browser. It is incredibly popular and is used by a wide range of developers. Being able to write JavaScript outside of the browser using Node makes it a very appealing technology for people because you can use it full-stack, both for front-end and back-end development.
What is NPM?
NPM (Node Package Manager) is the package manager for Node. It allows you to install and manage packages for Node. NPM is a big reason why Node is so popular today. There are so many packages that you can easily download that you can use to build your own applications.
When you install Node, NPM is automatically installed for you, so you can get started with it right away.
With that being said, let's get started by installing Node.
How to install Node on Windows
To download Node, you can use the Node download page and download the Windows Installer (.msi) file. This installer contains everything you need to install, update, or modify Node on your computer.
Make sure you select the correct version for your Windows operating system, as there are 32-bit and 64-bit versions available.
Node downloads page
Once the installer has downloaded, run it to begin the installation process. Accept the terms of the License Agreement to continue.
Node license agreement
Now set the path that Node will be installed to. It is recommended to leave it as the default.
Node installation location
Continue the installation process by clicking the "Next" button, and install Node. You should see this if you finished the installation process:
Node wizard complete screen
You have now installed Node on Windows.
How to install Node on Mac
To install Node on Mac, go to the Node download page and download the macOS installer (.pkg) file.
This installer contains everything you need to install, update, or modify Node on your Mac.
Node downloads page
Once downloaded, run the installer to begin the installation process.
Node installer on macOS
Agree to the License Agreement to continue.
Node license agreement
You can change the installation location but it is recommended to leave it as the default. Proceed and hit install.
Node installing on a Mac
Finally, you should see the confirmation that the installation was successful. Click close to finish the installation process.
You should now have Node installed on your Mac.
How to install Node on Linux
Linux has many different ways to install Node. This guide will show you how to install Node on Ubuntu using the easiest possible way.
Node provides a binary distribution page that contains the latest version of Node for each distribution.
Since we are using Ubuntu, let's follow the instructions for Ubuntu.
To start, you will need curl
installed to download the Node binary. If you don't already have curl
you can install it easily:
BASHsudo apt-get install curl
Now that you have curl
installed, let's download the latest Node binary for Ubuntu.
BASHcurl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
This will prepare your system to install Node by downloading the libraries required. After this command finishes, you can now install Node on your Linux system.
BASHsudo apt-get install -y nodejs
If all goes well, you should have a working Node installation on your Linux system.
Verify Node installation
To verify that Node is installed correctly, you can check the version of Node by running the following command:
BASHnode --version
This will return the version of Node that you have installed. If it does not, you will see an error message.
Verify NPM installation
Like with Node, you can also verify that NPM is installed correctly by checking the version that is on your system:
BASHnpm --version
This command will return either the version of NPM that you have installed or an error message if it is not installed.
Conclusion
Node is a popular JavaScript framework that is used by a wide range of developers and companies. NPM's popularity is a big reason why Node is so popular today due to how easy it is to share and install packages. Hopefully this tutorial has helped you get started with installing Node and NPM on your computer.
Happy coding!
Resources
- Getting Started with TypeScript
- How to Set Up Cron Jobs in Linux
- How to deploy a .NET app using Docker
- How to deploy a PHP app using Docker
- Using Puppeteer and Jest for End-to-End Testing
- How to Scrape the Web using Node.js and Puppeteer
- Learn how to build a Slack Bot using Node.js
- Building a Real-Time Note-Taking App with Vue and Firebase
- Getting Started with React
- Setting Up a Local Web Server using Node.js
- Using Axios to Pull Data from a REST API
- How To Create a Modal Popup Box with CSS and JavaScript