banner



How To Update Node In Terminal

Introduction

Node.js is an open-source JavaScript runtime environment. Since Node.js has an active customs of users, minor updates of the software come up out every few weeks.

You may be using Node.js as a layer of the Mean stack or in a different JS framework. Either way, make sure to update Node.js regularly to ensure organisation security.

In that location are several means to install Node.js and NPM. Likewise, there are several means to update your Node.js version, depending on the operating organisation running on your machine.

In this commodity, you will learn how to update to the latest Node.js version on Linux, Windows, and macOS.

tutorial on how to update Node.js to latest version

3 Ways to Update Node.js to Latest Version on Linux Systems

There are different ways to update Node.js if you are using a Linux-based organisation. Although using the Node Version Managing director is the easiest and most recommended option, you lot can as well update with the local parcel managing director or by downloading the binary packages.

Selection 1: Update Node.js with NVM (Node Version Manager)

The best way to upgrade Node.js is with NVM, a practical tool for managing multiple Node.js versions.

1. Start by updating the package repository with the command:

          sudo apt update        

ii. Install NVM using the whorl command:

          gyre -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash        

Annotation: If you don't take curl , install the utility past running the control: sudo apt install coil .

Alternatively, you use wget and run the command:

          wget -q0- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash        

three. Close and reopen the terminal for organisation to recognize the changes or run the command:

          source ~/.bashrc        

5. Then, verify if yous take successfully installed NVM:

          nvm --version        

6. Before upgrading Node.js, check which version you lot have running on the arrangement:

          nvm ls        

vii. At present you can check for newly bachelor releases with:

          nvm ls-remote        
see a list of all available Node.js versions

viii. To install the latest version, utilize the nvm control with the specific Node.js version:

          nvm install [version.number]        

Option 2: Update Node.js with NPM (Node Package Managing director)

Equally an alternative, you lot can use Node'due south official bundle manager to update Node.js. NPM is a tool for installing and managing package dependencies.

If you take Node on your system, you have NPM, every bit well. With the npm command, you tin check running Node.js versions and install the latest release.

By adding the due north module, you lot can interactively manage Node.js versions.

ane. Start, articulate the npm cache:

          npm cache make clean -f        
clear npm cache

ii. Install n, Node'due south version manager:

          npm install -g north        

iii. With the n module installed, y'all can utilise it to:

Install the latest stable version:

          sudo n stable        

Note: Some Ubuntu distros may answer with the command not institute output afterwards running the n command. To ready this issue run sudo -E env "PATH=$PATH" [command] . For instance, to install the latest stable version, equally in the example higher up, you would run sudo -E env "PATH=$PATH" n stable .

Install the latest release:

          sudo north latest        

Install a specific version:

          sudo north [version.number]        

Option 3: Update Node.js with Binary Packages

Updating Node.js with binary packages is the least recommended option. Nevertheless, if it is the only way y'all tin can upgrade to the latest Node.js version, follow the steps outlined below.

ane. Navigate to Node'southward official downloads page where yous tin can find all available packages. There you lot can download the source code or pre-congenital installer for the LTS versions or the latest release.

two. Y'all tin can either download the package from your browser or find the version number you need and add it to the wget command:

          wget https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz        

3. Adjacent, install xz-utils used to extract the binary package:

          sudo apt-get install xz-utils        

iv. Extract and install the bundle with the command:

          sudo tar -C /usr/local --strip-components i -xJf node-v14.17.0-linux-x64.tar.xz        

Update Node.js to Latest Version on Windows and macOS

Updating Node.js on Windows and macOS follows the aforementioned principles.

There are two unproblematic ways to upgrade:

  • Download the latest Node.js release from its official download folio and install the new Node.js release.
  • Install the due north module and update Node.js inside the final window.

Option 1: Update Node.js on Windows and macOS with Installer

I style to update your Node.js is to go to its official download page and install the newest release. Bz doing so, the system should overwrite the older version with the updated one.

1. Navigate to the Node.js website and click on the latest stable version or the newest current release (with the latest features).

two. Later deciding the version, click on theWindows or themacOS Installer, depending on the system you are using. The system downloads the parcel and stores it in the specified directory.

3. Once the download is complete, run the installer.

4. The Node.js Setup Wizard appears and guides you lot through the installation.

Node.js installation wizard

5. Accept the License Agreement by checking the box and click Next.

Node.js licensing agreement

6. Choose the destination folder where you want to install Node.js.

install latest Node.js on Windows

7. Node.js allows you to select how y'all want to install the Node features. Change the way the features are installed past clicking on the icons in the tree.

Custom Setup for Node.js

8. With that, the latest Node.js is ready to install. Click Install to ostend, wait until the installation completes, and click Finish.

nine. Check the Node.js version with the command:

          node -five        

Annotation: Sometimes, the organization fails to overwrite the older Node.js release and you may terminate up with two versions. If such problems occur, you may want to consider updating with NPM, outlined in the section beneath.

Selection 2: Update Node.js on Windows and macOS with NPM

If you lot want to upgrade Node.js from the control line, utilise the n model within the npm command. The due north characteristic allows you to collaborate with different Node.js versions.

1. Before updating the Node.js release, check which version you are currently using with:

          node -5        

2. Next, clear npm cache with the command:

          npm cache clean -f        

iii. Install northward globally:

          npm install -g n        

4. Now that you take northward installed, you lot can employ the module to install the latest stable release of Node.js:

          sudo n stable        

Alternatively, y'all can install the Node.js release with the latest features:

          sudo n latest        

Or, install a specific version number with:

          n [version.number]        

Determination

The best role of open up-source applied science is its strong community of users constantly working on upgrading the software.

Node.js is a proficient example of such software equally new versions come up out regularly. Users tin cull whether they want to work with the LTS (the long-term supported version) or the latest version with the newest features.

This article should accept helped you update Node.js on any operating system.

Was this article helpful?

Yes No

Source: https://phoenixnap.com/kb/update-node-js-version

Posted by: orozcofewind94.blogspot.com

0 Response to "How To Update Node In Terminal"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel