Logo

dev-resources.site

for different kinds of informations.

How to Get Started With Node and NVM on MacOS (M1/ M2) in 2023

Published at
12/8/2022
Categories
node
nvm
macos
javascript
Author
Gerry Aballa
Categories
4 categories in total
node
open
nvm
open
macos
open
javascript
open
How to Get Started With Node and NVM on MacOS (M1/ M2) in 2023

What are Node and NVM?

Node.Js, commonly known as Node, is a JavaScript runtime for building server-side or desktop applications. Node Version Manager(NVM) allows you to manage Node versions on your device. It is important because different projects on your device may be needing different versions of Node.

Having NVM and Node installed is a likely requirement for software engineers in 2023. This article has steps that make it easy to install Node and NVM on the new Apple Silicon Macs.

Step 1: Installing NVM

Run the following command in a new terminal window that will list all the files including hidden files in your device:

ls -a

If .zshrc is missing from the list, you need to create it by running the following command:

touch .zshrc

Insure you have the .zshrc now available in the list. Use cURL command from this site to install NVM. Copy and run this command in your terminal. It will look similar to this:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash

You will need to refresh the .zshrc file by running the following command:

source .zshrc

You can now confirm that you have NVM installed by running the following command. You should get a figure like 0.39.2.

nvm -v 

Step 2: Installing Node

Installing Node is now easy. Run this command in your terminal:

nvm install node

To install a specific version of Node, just add the version number at the end like this:

nvm install 18.12.1

To use Node, you will first have to run the following command in your terminal:

nvm use node

or run a specific version of Node:

nvm use 18.12.1

Remember Node installation includes the Node Package Manager(NPM). You are ready to use all the resources that Node presents to you. Thank you for getting to the end of this article. You are great!

Photo by AltumCode on Unsplash

Featured ones: