In this article, we will see how to install nodejs in macos. How to Install/Update Nodejs in Mac OSX.
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,
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
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.02n lts
Once you complete the installation of nodejs and npm . you can verify the installation using the command,
1npm --version2node --version
it will show you the installed versions of nodejs and npm. How to install nodejs in macos.
No spam, ever. Unsubscribe anytime.