How to Install Node.js and NPM on Mac

Introduction

Node.js and NPM are two of the most popular tools used for developing web applications. Node.js is a JavaScript runtime environment that allows you to run JavaScript code on the server side, while NPM is a package manager that helps you manage and install packages for your Node.js applications. Installing Node.js and NPM on Mac is a relatively straightforward process, and in this guide, we will walk you through the steps.

How to Install Node.js and NPM on Mac

1. Download the Node.js installer from the Node.js website.

2. Run the installer and follow the on-screen instructions.

3. Open a terminal window and type node -v to confirm that Node.js is installed.

4. Type npm -v to confirm that NPM is installed.

5. You can now use Node.js and NPM to develop applications.
[ad_1]

Introduction

Node.js is a popular back-end JavaScript runtime used for creating web servers and scalable network apps. The environment supports server-side scripting – producing dynamic content for web pages before they are served to the user.

NPM is a package manager for JavaScript and the default package manager for Node.js. As such, NPM is installed alongside Node.js as a recommended feature.

This tutorial will show you how to install Node.js and NPM on Mac using the Homebrew package manager.

How to Install Node.js and NPM on Mac

Prerequisites

  • Access to the terminal
  • Administrative level privileges

Note: Node.js has a PKG installer for macOS available on its website. However, installing with Homebrew is the recommended approach.

Install Homebrew

1. To install Homebrew on macOS, browse to Homebrew’s official website and copy the link displayed on the page.

Copying the install command for Homebrew on MacOS

Note: Do not copy the command from the screenshot since it may change in the future. Always visit the website for the up-to-date command.

2. Open the terminal and paste the command. Type the sudo password when prompted. Lastly, confirm that you want to install Homebrew by pressing Return.

Installing Homebrew on MacOS

Install Node.js and NPM on Mac

Note: For other operating systems, refer to our tutorials on installing Node.js and NPM on Windows, Ubuntu, CentOS, and Debian.

1. Type the following command to install Node.js and NPM:

brew install node

Homebrew downloads and installs the dependencies.

Installing Node.js and NPM on MacOS using Homebrew

2. When the installation finishes, confirm that you successfully installed Node.js by checking its version:

node -v

The system displays the Node.js version as the output of the command.

Checking the version of the Node.js installation on MacOS

3. Next, check the installed version of NPM by typing:

npm -v

The NPM version number is displayed.

Checking the version of the NPM installation on MacOS

Update Node.js and NPM on Mac

1. Before you proceed with upgrading the Node.js installation, update Homebrew’s repositories by typing:

brew update
Updating Homebrew in MacOS

2. When the update completes, type the following command:

brew upgrade node

The output in the example shows that the newest version of Node.js is already installed on the system.

Upgrading the Node.js and NPM installation with Homebrew on MacOS

Uninstall Node.js and NPM on Mac

1. Uninstall both Node.js and NPM with the brew uninstall command:

brew uninstall node
Uninstalling the Node.js and NPM installation with Homebrew on MacOS

2. Remove all the unused dependencies with:

brew autoremove
Removing the unused dependencies with Homebrew on MacOS

This command removes the packages that brew uninstall did not remove.

Conclusion

After reading this tutorial, you should know how to use Homebrew to install Node.js and NPM on macOS. If you wish to find out more about the MEAN stack, which features Node.js, read LAMP vs. MEAN: Which is Better?

[ad_2]

How to Install Node.js and NPM on Mac

Installing Node.js and NPM on Mac is a relatively straightforward process. Node.js is a JavaScript runtime environment that allows you to run JavaScript code outside of a browser. NPM is a package manager for Node.js packages, or modules if you like. In this tutorial, we will show you how to install Node.js and NPM on a Mac.

Step 1: Download Node.js

The first step is to download the Node.js installer from the Node.js website. Go to https://nodejs.org/en/ and click on the “Download” button. This will download the Node.js installer to your computer.

Step 2: Install Node.js

Once the download is complete, double-click on the .pkg file to start the installation process. Follow the on-screen instructions to complete the installation. Once the installation is complete, you should be able to open a terminal window and type “node -v” to check the version of Node.js that is installed.

Step 3: Install NPM

NPM is installed with Node.js, so you don’t need to install it separately. To check the version of NPM that is installed, open a terminal window and type “npm -v”. This will output the version of NPM that is installed.

Conclusion

In this tutorial, we have shown you how to install Node.js and NPM on a Mac. Installing Node.js and NPM is a relatively straightforward process, and once it is complete you can start using them to develop applications.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00