LEARNNode CLI Automation

Node.js with nodenv

There are several ways to install Node.js. One of them is through it’s binary. This way of installation is not recommended since Node.js is constantly getting updates.

So to stay up-to-date. Node.js has many version managers. For instance, nvm, n, nodenv, asdf, etc. Today I am going to show you the working of nodenv which is an excellent Node version manager.

Installation

The first thing you need to do is install nodenv. You can either do this with Homebrew or you can use curl. If you have decided to go with Homebrew, copy-paste the following command in your terminal and press the Enter key.

brew install nodenv

If you are using curl, then do the same thing I described above but with the following command.

curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash

This will install nodenv on your computer.

Usage

Now to install Node.js on your computer, you need to run the following command.

nodenv install $version

You need to provide the version you want to install. You can also install multiple versions if you want.

To list all the available versions, nodenv provides you a command. Just copy and paste it into your terminal.

nodenv install -l

Wrapping Up

nodenv is an excellent Node.js version manager that you can try. If you are interested in taking a deep dive into it, here is the link to its documentation.

Posted by Saad (It's a work in progress: Needs copy editing review by Awais.)