How to Install NodeJS and NPM on Windows and Mac?
Now let us understand what Node.js is.
It was developed in 2009 by Ryan Dahl. Since it uses an asynchronous, event-driven model, it is the best option for building data-intensive applications.
Now, that you know about NodeJS, let’s see how to install NodeJS and also the Node Package Manager (the default package manager for NodeJS), popularly known as NPM.
- RAM >4GB
- CPU Intel Core i3TM i3 HQ CPU @2.50 GHz
- ROM >256GB
- Required Software :- Chocolatey
Node Package Manager (NPM)
We already know that NPM is the default package manager for NodeJS. NPM allows open source web developers to share and borrow packages for application development. It also serves as a command line utility for the application to install packages in the project, manage dependencies and even version management.
Components of NPM –>
- Website: You can find packages for your project and also set up profiles to manage these projects on the official NPM website.
- Command line interface (CLI): To work with NPM packages and repositories, there is NPM’s Command Line Interface.
How to Install NodeJS and NPM on Windows?
Now, let’s see how to install NodeJS on Windows. So, here’s the first step:
- Download the Installer (the latest version with the apt. bit version).
- Thereafter, double click on it and install it. You can save that .msi file in your desired location.
- Also, make sure you select your NPM package manager, not the default Node.js runtime, to facilitate installing Node and NPM at the same time.
- That’s it! Your setup is ready to install Node and NPM.
- Now, click on the download button to start the process.
# To confirm the installation of Node $ node -v command. # To confirm the NPM installation $ npm -v command.
How to Install NodeJS and NPM on Mac?
Now, let’s see how to install NodeJS on Mac. So, here’s the first step:
- Download the .pkg installer
- Thereafter, save it to a desired location.
- Next, launch the Node.js Installer using the following steps:
- Introduction –> Continue License
- Choose Next –> Agree to Installation Type
- Install –> Authenticate with your Mac to allow installation
- Install Software Summary –> Close
- Verify your NodeJS Installation using the below command:
$ node -v
- Now, you will need to update your NPM version, using the below commands:
$ sudo npm install npm --global
- Thereafter, set the “NODE HOME” variable in the system environment variables.
$ export PATH =/usr/local/git/bin:/usr/local/bin:$PATH
- Actually, it is advisable to write this command in .bash_profile or .zshrc.
- However, it depends on which shell you use so that this path export remains on your system and cannot be recognized by all terminal instances.
- That’s it! You have successfully installed NodeJS on your MacOS device.
Using “HomeBrew” to install NodeJS –>
Homebrew is an open source and free software package management system that simplifies the installation process on macOS and Linux. It installs the packages into their directory and their files into /usr/local. Here are the steps to install NodeJS using Homebrew:
- Run the below command in your terminal.
$ brew install node
- Thereafter, verify that the installation is successful, using the below commands:
$ node -v $ npm -v
- Thereafter, update your Homebrew version, using the below command:
$ update brew
- Finally, use the below command to upgrade the version of NodeJS
$ brew upgrade node
WRAPPING UP!! –>
By now, I can safely, vouch that you have definitely got the answers to your question, how to Install NodeJS and NPM on Windows and Mac?. Not only that, you have also come to know about various other facets related to NodeJS and NPM. So, all in all, you have acquired a great deal of knowledge. With that, do remember, if you’ve any confusion or questions thus whatsoever about this topic, you can always reach out to me in the comments section and I will readily try to help. On that note, until the next time, see ya!! Goodbye!!