Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 24, 2022 06:22 am GMT

The Easiest Way To Install Node.js on Linux/MacOS

I've been riding the learn (build) in public wave for the past month.

Here's what I've been doing:

  • I code or learn for an hour
  • Report my progress on Twitter
  • Push my code to GitHub for others to see

I started learning Typescript a week ago. When I started setting up my laptop for Typescript, I needed to find a way to install Node.

I found that Node Version Manager (nvm) was one of the easiest way to install Node.

Installing nvm is super easy

You find the instructions on the official repository. Run the following:

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

Then paste the following in your profile file:

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

If you face any issues, refer to the README.

Install Node using nvm

Installing a specific version of Node:

nvm install <SPECIFIC_NODE_VERSION>

Installing the latest LTS version:

nvm install --lts

Using the installed Node version

Switching between Node versions is simple when using nvm. This is helpful when your different Node projects use different versions.

You can choose which Node version you want to use:

nvm use <SPECIFIC_NODE_VERSION>

Conclusion

I recommend installing nvm. It simplifies the process of installing NodeJS. The bonus is having different versions of NodeJS installed.

Let me know what you think. Are there better alternatives? Suggestions?

Thank you for reading!


Original Link: https://dev.to/maupanelo/the-easiest-way-to-install-nodejs-on-linuxmacos-5c54

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To