SOOS partners with DigitalOcean to offer marketplace one click add-on.

Change Node Version

The JavaScript runtime environment Node.js provides developers with server-side scripting and is used by several The JavaScript runtime environment Node.js provides developers with server-side scripting and is used by several corporations, including Netflix, LinkedIn, and PayPal. New versions of Node.js are frequently released. For developers who work in multiple applications and on multiple projects, the need to change Node versions occurs often. Many developers also need to switch between various npm registries while working in a development environment. Fortunately, tools exist to facilitate changing between node versions and npm registries. There is also software to protect an organization’s codebase from vulnerabilities and license exposure, a possible side effect of changing Node versions. First, though, learn about Node.js and how to easily change versions.

What Node.js Is

Originally authored by Ryan Dahl and developed by the OpenJS Foundation, Node.js is a cross-platform, back-end, open-source JavaScript runtime environment. It has the advantage of allowing developers to use JavaScript for server-side scripting and writing command-line tools. What this means is that a dynamic web page does not have to be produced from script on the user’s platform. JavaScript creates the page server-side and sends it to the client. This enables developers to use a single programming language and helps streamline the development process.

Node.js is particularly good for designing browser games and real-time communication scripts, as its architecture is event-driven and allows for asynchronous input/output.

History of Node.js

In 2009, 13 years after the introduction of Netscape’s LiveWire Pro Web (the first server-side JavaScript environment), Ryan Dahl wrote the initial version of Node.js. The first release supported only Mac and Linux, but a native Windows version, sponsored by Joyent, was released in 2011.

In 2010, npm was introduced. This is a package manager that facilitates sharing and publishing source code of Node.js packages by developers. npm makes it much easier to install, update, and uninstall packages. In 2019, the OpenJS Foundation was formed and continues to be the current developer of Node.js.

Node.js Versions

There are two categories of Node.js versions, each with more than one version within it. They are:

LTS Version

LTS stands for “long-term support.” Any version with this designation, though not the latest, is still in use and supported and maintained by the developer for a longer time than other older versions. This is useful in that bug fixes, security updates, and minor features are still available for use in these versions.

Latest Features (Current) Version

The Latest Features (Current) Version is exactly what its name implies. It is the version currently in development. It is kept in a separate category so major features, architectural changes, and performance enhancements may be developed and added without affecting the stable older environments. It also allows those loyal to the older versions to keep using them. 

As the version cycle reaches its end, the codebase for the Latest Features Version is moved to LTS with all upgrades and added features intact. It is by then a more secure and stable environment. The Latest Features Version is generally used for experimentation due to its changing and untested nature. LTS versions are usually recommended for most users.

When Different Versions of Node.js Are Needed

For Node.js in production, the recommendation is to use the even-numbered LTS versions. These are the most stable and secure. On the download page, the current version is the one being developed and may still have bugs being worked out. A version remains current for six months before being moved to LTS. The OpenJS Foundation supports an LTS version for 30 months, during which any bugs will be fixed.

For most uses, a developer wants an LTS version that is still within the 30-month support window. However, let’s say the work involves multiple projects and includes one in which the latest JavaScript features would be useful. The LTS version may not support those features. It would then be necessary to switch to the current version to enable trying out those features.

Another situation would be when working on an older script that does not support the latest LTS version. In that case, it becomes necessary to switch to the latest version the script supports. It’s common for developers to have multiple versions of Node.js installed and to switch between them while working.

How To Change Node Version

Changing the node version is not hard with the right tool. Node version managers make changing between versions during development fast and easy. Which is the best one to use depends upon the platform. Two of the most popular version managers are NVM for Windows and the n Node version manager for Linux and Mac.


For Windows, NVM is the standard version manager.


Go to GitHub and download the latest version of NVM for Windows. It’s as simple as that. Extract the .zip file and double-click the executable to begin installation. NVM will be placed in an appropriate folder on the machine and “nvm” and future versions of Node will be available on the command line. More detailed instructions can be found on the GitHub website.

User Commands

Let’s say a developer is working on two different applications and needs to use three different versions of Node. Get the first application running. Now follow these steps:

  1. Use “nvm available” to see a list of the Node versions that are available to be installed.
  2. Now use the “nvm install” command with the version number needed for that application.
  3. Next, the “nvm use” command activates the chosen version that was just installed.
  4. Use “nvm list” to confirm that the desired version is installed and activated.

Get the second application running and use the same procedure to activate the version that one requires. This is the process for changing node versions during work on any application. Simple, isn’t it?

Linux and Mac

Linux and Mac require the easy-to-use n Node version manager


After downloading n Node version manager from GitHub, it must be installed. This is easy if the users already have a version of Node or npm installed on their computer. Simply install it like any other npm package by using the npm install -g n command.

If there is no version of Node or npm installed on the machine, the developer can install n Node version manager using a bash script from GitHub. To do this requires having Git installed. The command looks like this: ~$ curl -L https: // | bash. The program will respond with a message that says “n successfully installed.” It is now ready to use.

User Commands

Staying with the previous example of two applications and three versions of Node, here is the process:

  1. Get the first application running.
  2. Use the command n followed by the version number needed by the application. It is that simple.
  3. It’s also possible to use the command n latest to use the current version of Node or n lts for the latest LTS version.

Now run the second application and repeat the steps to switch to the desired version of Node. The n Node version manager is easier to use than the NVM for Windows. It also allows the use of a specific Node binary without having to switch to that version of Node. Use the n use command with the binary number and then “index.js” This is a convenient feature for when a specific binary is needed to execute a script, but the developer wishes to stay with the version currently active for continuing to work in the application.

Why Open Source Software Analysis Is Vital

Like any other open-source software, Node.js script is subject to vulnerabilities, unwanted licenses, and license conflicts. These are headaches nobody needs. Secure and compliant software is not an option–it’s a necessity. SOOS’s software composition analysis tool is an affordable and effective solution to security and compliance problems. It integrates seamlessly with Node.js as well as these languages:

  • Java
  • Ruby
  • Python
  • .NET

It also works with these CI/CD systems:

  • Travis CI
  • Circle CI
  • TeamCity CI/CD
  • Atlassian Bamboo and Jira
  • Microsoft Rocket
  • GitHub Actions
  • Amazon Web Services CodeBuild

SCA Features for Node.js

SCA offers a number of useful features.


During building, SCA catches and fixes vulnerabilities so they don’t make it to production. Just integrate the SOOS with the CI/CD pipeline. It’s fast, easy, and effective.

Security Analyst

Our SCA software monitors and detects security vulnerabilities continuously during the build process. It displays the total number of vulnerabilities, vulnerable projects, and the severity of them. We search for over 100,000+ known vulnerabilities.

Legal Analyst

The legal analyst dashboard of the SCA product displays all license exposures and can make sure the developer doesn’t use any libraries that can cause unwanted legal consequences–no developer or company wants to be involved in a lawsuit that could have been avoided.

It is often necessary for developers to change node version and npm registries when working on multiple projects. With a little knowledge and the right tools, this is not as difficult as it sounds. For any developer or software company, security is essential. Developers and companies can be protected from vulnerabilities and license exposure with SOOS’s SCA.

Copyright © 2022 SOOS| Terms of Service | Privacy Policy