In this tutorial, we will show you how to install node js and npm and verify it on Mac OS M1 or M2 using Homebrew.
How to Install Node.js and npm on Mac OS M1 or M2 using Homebrew
You can follow these steps:
Step 1: Download and Install Homebrew
Run the following command to install Homebrew on Mac OS system:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run brew update
to make sure Homebrew is up to date:
brew update
Step 2: Install Node.js
Now, let’s install node.js on mac os m1 or m2 using brew install node command, run the command:
brew install node
This will download and install the latest version of Node.js on your macOS system.
Step 3: Verify Node.js Installation
Verify the installation of your node.js, by using the below-given command:
node -v
Step 4: Install npm
Now you can install npm with the help of brew command. Which is given below:
brew install npm
Step 5: Verify npm Installation
By running npm -v command on terminal or cmd to check npm is install or not:
npm -v
This command will show you the version of npm.
Conclusion
That’s it! You have successfully installed Node.js and npm on your macOS system.