How to Install Node Version Manager (NVM) on Windows and MacOS

Node.js is a cross-platform, open-source JavaScript runtime atmosphere that runs on Chrome’s V8 JavaScript engine and lets you run JavaScript code outdoors the context of an internet browser, corresponding to on the server aspect. This makes Node.js an excellent device for builders to make use of when creating server-side functions.

Node.js has turn into so in style that the Stack Overflow Developer Survey ranked it as the preferred net framework amongst skilled builders and builders studying to code.

software-developer-6521720_1920

As a result of Node.js is consistently being developed and improved, new variations of Node.js are launched infrequently. This usually leads to new options being added to the framework, some older options changing into out of date, and even modifications in the best way sure performance is carried out within the framework.

Which means when builders construct functions with Node.js, these functions are deployed with totally different variations of Node.js.

This in flip implies that an utility deployed with a specific model of Node.js, corresponding to Node.js model 9.x, might produce sudden outcomes or throw errors once you attempt to run it with a distinct model of Node .js, corresponding to Node.js 20.x.

To repair this, it is advisable preserve uninstalling your present Node.js model and set up the required Node.js model whereas working with totally different Node.js initiatives.

In a standard work atmosphere, a developer might have to do that a number of occasions as he strikes between initiatives, which might shortly turn into very painful and tiresome. Thankfully, there’s a higher means to do that through the use of the Node Model Supervisor (NVM).

Nodejs FAQ Interview Questions

The Node Model Supervisor (NVM) is a command line device that lets you set up and handle a number of variations of Node.js in your laptop. As well as, you possibly can simply change between the totally different Node.js variations put in in your laptop. This makes nvm a necessary device for anybody working with Node.js, even when they’ve but to work on initiatives with totally different Node.js variations.

Let’s examine how one can set up nvm on Home windows or MacOS.

Necessities for putting in NVM

Earlier than putting in nvm, be sure to uninstall any present Node.js variations to keep away from conflicts after putting in nvm. If you’re utilizing Home windows, you possibly can go forward and likewise delete the folder the place Node.js was put in in your laptop. That is normally the nodejs folder positioned in program information

When putting in nvm on MacOS, be sure to manually set up the Xcode command line instruments earlier than making an attempt to put in nvm.

In any other case the set up will fail. This text describes how to do that within the part on putting in nvm on macOS. Putting in Xcode command-line instruments requires MacOS model 13 or later and roughly 2.5 GB of free disk house.

How one can set up NVM on Home windows

The unique Node Model Supervisor was created for Linux and Mac working programs and never for Home windows. In that regard, the NVM we’ll be putting in on Home windows is a bit totally different from the NVM used on Linux and Mac.

Nevertheless, it’s the NVM really helpful by Microsoft and Google for Home windows working programs.

To put in NVM in your Home windows laptop, comply with these steps

1. Go to nvm releases to view the nvm releases. Underneath Belongings, click on the newest nvm setup.exe to obtain the newest nvm installer.

Assets1

2. As soon as the obtain is full, open the installer and choose Sure when requested if you wish to permit the app to make modifications to your machine or not.

3. On the License Settlement display screenchoose I settle for the settlement then click on Subsequent one

License2

4. On the Choose Vacation spot Location display screen, point out the place you need to set up nvm for Home windows and click on Subsequent one

Location3

5. On the Arrange Node.js Symlink display screen, specify the place you need to set the Symlink by clicking it Subsequent one. That is the place the working model of Node.js might be discovered.

Symlink4

6. Now that every little thing is ready up, it is now time to put in nvm. On the Prepared to put in display screen, click on to put in to put in nvm in your machine.

Install5

7. As soon as the set up course of is full, click on End

Finish6

8. To substantiate that the set up is full, open Home windows PowerShell and run it as administrator

Powershell7

9. As soon as in Powershell, run it

nvm -v

If the set up was profitable, it’s best to see a display screen with the model variety of the nvm you put in.

Version8

With nvm put in, you possibly can go forward and use it to put in and handle a number of variations of Node.js

How one can set up NVM on macOS

When putting in nvm on MacOS, it is strongly recommended that you simply set up it straight from GitHub and never by Homebrew, the package deal supervisor for macOS. As well as, it’s essential to manually set up the Xcode command-line instruments in your laptop. Due to this fact, our first steps will cowl how one can set up Xcode command line instruments. To do that, comply with these steps:

1. Go to the Apple builders obtain web page

2. Seek for command line instruments for Xcode. Obtain the newest model that isn’t a beta or launch candidate

Screenshot-2023-07-12-at-21.49.50

3. Open the downloaded .dmg file and run the command line instruments.pkg file. This begins with the command line instruments installer.

package

4. Click on Get on

1-2

5. Click on Get on. You can too change your most popular language on this display screen.

2-1

6. Click on Agree to proceed the set up, then click on to put in to put in the command line instruments.

3-1

As soon as the command line instruments are put in, the following step is to put in nvm on Mac. To do that, comply with these steps:

  1. Open your terminal and confirm that your Mac’s dwelling listing has a .zshrc by executing
ls -a

2. When you do not see a .zshrc file in your house listing, create one by working

contact ~/.zshrc

3. Copy the next command to your terminal and run it:

curl -o- https://uncooked.githubusercontent.com/nvm-sh/nvm/v0.39.3/set up.sh | bash
Screenshot-2023-07-12-at-22.12.09

The above command will obtain and run a script. The script clones the nvm repository and thus installs nvm in your Mac.

To substantiate that nvm has been executed, run the next command in your terminal

nvm -v

When you see a model quantity, the set up was profitable.

Conclusion

The node model supervisor is a necessary device for builders working with Node.js because it lets you simply work with totally different Node.js variations, handle the variations and change between them simply. If you’re a developer working with the Node.js framework, think about putting in nvm in your laptop.

You can too discover how one can set up Node.js and NPM on Home windows and macOS.

Rate this post
Leave a Comment