How To Install Nvm Windows

So you want to develop using the JavaScript run-everywhere platform on the same computer where you game, edit videos, code C# desktop apps, or any.
You are also aware that at that place are multiple Node.js versions in active development and it is adequately common to discover projects in the wild that only run in a scattering of them.
Then this guide is for you. Then let's set upwardly a Windows automobile for Node.js with multiple version management, while also addressing common pitfalls.
How to Install Windows Terminal
If you lot are using Windows 11, proficient news: you already have the Windows Terminal installed. If not, open the Microsoft Store and download it costless of charge.

This is a hardware-accelerated tabbed terminal from which you can run Powershell, CMD or WSL interfaces. And information technology'southward an important (and, some would say, pretty belated) step towards making the Windows development feel similar to other major OS'southward.
Installing this terminal is highly recommended if you program to develop on Windows, using Node.js or otherwise.
How to Install NVM for Windows
Now, instead of installing Node.js from the official website, nosotros should install the Node Version Managing director and download Node versions from there.
If you lot already have Node installed this should not exist a major trouble as NVM will overwrite any node-related surroundings variables and symlinks. Yet, I'd recommend that y'all uninstall it anyway every bit this procedure will return the current installation completely useless.
Go to the NVM for windows projection folio and download the latest bachelor version's nvm-setup.zip
from the releases page.
Notation that this is non the same equally the UNIX-based NVM project, although it is functionally equivalent. "Similar, not identical" equally the project itself discloses.
Unzip the folder's contents and run nvm-setup.exe
. You'll exist prompted to agree with the project's terms of use (currently it'due south the MIT License), then the installer will ask where to install nvm. This will also be the aforementioned location as the downloaded node versions and their globally-enabled packages. The roaming app information folder under your current user should exist perfectly fine.
However, y'all'll so be prompted to indicate where to keep the Node.js symlink, and (at to the lowest degree in versions up to 1.ane.8) there'due south a catch: you cannot keep the symlink under a path which contains whitespaces, and unfortunately the default installation path (currently C:\Program Files\nodejs
) steps right into this trap.

This is where I've installed my local NVM. It's only a suggestion and yous can install wherever you like (as long equally the path does not contain whitespace). I'd merely recommend making the target folder'south proper name something like \nodejs
and so you don't end up losing the installation, which can be removed directly from the standard uninstaller anyway.
How to Install Node & Setup NVM
Outset of all, you need to run Windows Concluding with administrative privileges. Ane way you can do this is by looking for the terminal in the system'south internal search, clicking with the right button on its icon, and then selecting 'Run as Administrator'.

Whatever time y'all feel lost while fiddling with NVM, only type nvm
in the terminal and a very concise manual will pop up explaining each available command and their parameters.

Let's make certain NVM is enabled. Just run:
nvm on
And after that, allow's install the electric current Long Term Support version, pre-aliased as lts
(currently 14.xviii.1):
nvm install lts
After the installation finishes, nosotros must declare to NVM what version nosotros'd like to use:
nvm utilize 14.18.1
Great! Now, Node.js-specific commands such as node
and npm
volition be mapped to that node version. Let'due south celebrate by installing the yarn packet manager:
npm install -grand yarn
After the installation ends, allow's bank check if everything went OK:
yarn -5
If you lot become the yarn version as output, congratulations! The set-up was properly done.
How to Manage Multiple NodeJS Versions
Now that we accept the LTS version, what's the skillful of having a version manager if not to use different versions? Let'south besides install the most recent Node version, pre-aliased every bit latest
(currently 16.11.i):
nvm install latest
Anytime you'd like to cheque your locally installed versions, run
nvm list
to become a list of the ones available in your system. To change your current version, but run nvm utilise again, this fourth dimension pointing to the newly-installed one:
nvm apply xvi.11.ane
Note that if you lot run yarn -five
again you will non receive a version number as yarn is non currently installed for your local sixteen.11.1. Every installed version is completely self-contained, which includes admission to global packages.
Congratulations, you are at present an organized Windows Node.js programmer who follows the best practices of localized version management.
How to Troubleshoot Common Problems
My downloads through npm/yarn are Actually dull.
Outset of all, make sure the network you are connected to is classified equally 'private' by Windows, equally the Windows firewall can be very picky on public networks.
In case the problem persists, whitelist the nvm directory (should be C:\Users\<your_user_name>\AppData\Roaming\nvm
if you kept the defaults) in your antivirus software.
Running stuff in node (e.thou. transpiling a Typescript projection) is Actually slow.
Windows uses the NTFS filesystem which is peculiarly bad at dealing with tasks involving a very large number of small files. And Node projects are notorious for the many different modules which depend on many dissimilar other modules, so this problem is harder to mitigate.
Short of getting an SSD, your best bet would be to ready Node on Windows Subsystem for Linux in example execution speed is unworkably slow.
I'g getting a 145 exit code in some NVM commands.
Take a look at the Install NVM for Windows role of this tutorial, particularly the one regarding the symlink location.
You must have installed NVM in a directory path with whitespaces. So only uninstall NVM and re-run nvm-setup.exe
, this time making sure no selected paths contain whitespaces.
Determination
If you can install versions from the command line and switch between them (think you'll demand to accept admin privileges to switch between versions), then all the remainder is upward to you equally a JavaScript (or TypeScript) programmer.
If you need to install a code editor, I'd recommend Visual Studio Code for convenience, Sublime Text 3 as a lightweight culling to VSCode, or vim if you feel like you have the time and effort to learn a new skill.
Learn to lawmaking for free. freeCodeCamp's open up source curriculum has helped more than forty,000 people become jobs as developers. Get started
Source: https://www.freecodecamp.org/news/set-up-windows-for-nodejs-development-with-nvm/
Posted by: walkersolds1992.blogspot.com
0 Response to "How To Install Nvm Windows"
Post a Comment