How to install nodejs in macos

In this article, we will see how to install nodejs in macos. How to Install/Update Nodejs in Mac OSX.

Recent Articles,

TypeScript for React developers in 2020

Implement Multi Threading in Nodejs with a real world use-case

A Complete Guide to AWS Elastic Load Balancer using Nodejs

Basically there are few methods to install Nodejs in Mac. they are,

Using Node version Manager(nvm)

Firstly install the nvm in your machine using the command

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

the above command downloads the binary and stores it in ~/.nvm. Now you need to add the variable in the bash profile.

1~/.bash_profile

and add the following code in the profile

1export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
2[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

For Reference : nvm docs

you can verify the installation of nvm using the command

1command -v nvm

Now, you can install or update the nodejs using nvm easily

1nvm install 10
1nvm use 12

Using Node Package Manager(npm)

you can install nodejs using a npm package called n. Once it is installed, make sure to clear the cache using the command

1sudo npm cache clean -f

After that install the n npm module in your machine

1npm install -g n

Now, you can install the nodejs using the command

1n 10.16.0
2n lts

Summary

Once you complete the installation of nodejs and npm . you can verify the installation using the command,

1npm --version
2node --version

it will show you the installed versions of nodejs and npm. How to install nodejs in macos.

To Read More

Kubernetes for Nodejs developers

Do you keep hearing the word kubernetes in the tech community and you couldn't u...

TypeScript Interfaces vs Types

In this article, we will see what are interfaces and types and the difference be...

How to find project ideas to practi...

Ever wondered what how to get a real world experience on web development while w...

Building a Production-grade Nodejs,...

This article is the first part of building a production grade nodejs,graphql and...

Modern React Redux Tutorials with R...

This tutorial explain how you can build an application using modern react redux ...

Building a Piano with React Hooks

In this article, we will see how to build a piano with react hooks. Building a P...

TypeScript Basics - The Definitive ...

In this article, we will learn some basics of typescript which helps you to deve...

Here's why podman is more secured t...

In this article we will see about podman and why it is more secured way to run c...

What is gRPC ? How to implement gRP...

Everyone talks about gRPC. Have you ever wonder how it works or how to implement...