



I would recommend you use the npm library ’n’, which you can install with: npm n What if I don’t have the ability to access the internet (specifically GitHub) outbound on my device?

Here’s how: #After navigating to the project in question rm -rf. NVM won’t automatically do this for you, so in the event that your project no longer builds due to library issues you need to regenerate your package-lock.json and node modules folder. One caveat that you are sure to run into, however, is that major node version changes will not play nice with a number of popular libraries if you don’t install the packages for that specific node version. You could also have just specified nvm uninstall 10, which will only uninstall the latest version of node 10. This will use the latest installed version of Node 12 automatically, and will uninstall node 10.2.1. Since both are currently installed, you don’t need to install whatever version of node 12 you have again, but instead nvm use 12 nvm uninstall 10.2.1 However, let’s say that you decided to not use that library after all, and instead, want to update back to your previous node 12 version and get rid of the node 10 installs. Let’s look at a couple of examples.įor instance, let’s say you need to use some novel library that only supports node up to 10.2.1, and this was your only active node 12 project, you would enter the following: nvm install 10.2.1 Once you have the latest version of nvm, you should have the ability to update Node to whatever version you prefer, as well as remove any other versions you would rather not have around. If you have a standard npm setup and aren’t working on a device connected to the open internet, you can ensure you have version 38 of nvm (the most current version as of this article’s date) by typing: curl -o- | bashįor newer versions of nvm, you may have to update the command above using the newest installation script in the “install and update” section of the nvm GitHub repository. In general, later nvm versions are compatible with earlier versions of Node, so you don’t lose anything by updating your nvm package. Note that while I say “update”, you can just as easily use nvm to specify an older version of Node than the one currently running.įirst things first, you need to install nvm if you don’t already have it, and optionally update the nvm library if it hasn’t been changed in a while. Most of the steps also work for the npm library called ‘N’, but the syntax for the N-specific commands will be slightly different depending on how you wish to specify your Node version. This article will guide you through all the steps required to update your Node.js version using nvm.
