How To Upgrade Node In Windows
Introduction
Node.js is an open-source JavaScript runtime surroundings. Since Node.js has an agile customs of users, minor updates of the software come out every few weeks.
You may be using Node.js as a layer of the MEAN stack or in a dissimilar JS framework. Either way, make sure to update Node.js regularly to ensure organisation security.
There are several ways to install Node.js and NPM. Besides, there are several means to update your Node.js version, depending on the operating organization running on your machine.
In this article, you will learn how to update to the latest Node.js version on Linux, Windows, and macOS.
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 system. Although using the Node Version Manager is the easiest and near recommended option, you can also update with the local package manager or by downloading the binary packages.
Option ane: Update Node.js with NVM (Node Version Manager)
The all-time 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 2. Install NVM using the ringlet command:
roll -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | fustigate Note: If yous don't have curl , install the utility by running the command: sudo apt install curl .
Alternatively, yous utilize wget and run the command:
wget -q0- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash 3. Close and reopen the final for system to recognize the changes or run the command:
source ~/.bashrc v. And so, verify if you have successfully installed NVM:
nvm --version
six. Before upgrading Node.js, check which version you lot have running on the system:
nvm ls 7. Now you can check for newly available releases with:
nvm ls-remote
viii. To install the latest version, employ the nvm command with the specific Node.js version:
nvm install [version.number] Pick 2: Update Node.js with NPM (Node Package Manager)
Every bit an alternative, you tin can apply Node'due south official bundle manager to update Node.js. NPM is a tool for installing and managing packet dependencies.
If you have Node on your system, you have NPM, also. With the npm command, you tin cheque running Node.js versions and install the latest release.
By calculation the northward module, you can interactively manage Node.js versions.
i. Showtime, articulate the npm cache:
npm cache clean -f
2. Install n, Node's version manager:
npm install -g n
3. With the north module installed, yous can use it to:
Install the latest stable version:
sudo n stable
Note: Some Ubuntu distros may respond with the command not found output after running the n command. To prepare this issue run sudo -East env "PATH=$PATH" [command] . For case, to install the latest stable version, as in the example above, you would run sudo -E env "PATH=$PATH" n stable .
Install the latest release:
sudo north latest
Install a specific version:
sudo n [version.number]
Option iii: Update Node.js with Binary Packages
Updating Node.js with binary packages is the least recommended option. However, if it is the only way yous can upgrade to the latest Node.js version, follow the steps outlined beneath.
one. Navigate to Node's official downloads page where yous tin find all available packages. In that location you can download the source lawmaking or pre-congenital installer for the LTS versions or the latest release.
two. You 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. Next, install xz-utils used to extract the binary package:
sudo apt-go install xz-utils iv. Extract and install the package with the command:
sudo tar -C /usr/local --strip-components 1 -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 simple ways to upgrade:
- Download the latest Node.js release from its official download page and install the new Node.js release.
- Install the n module and update Node.js within the last window.
Option 1: Update Node.js on Windows and macOS with Installer
One manner to update your Node.js is to go to its official download page and install the newest release. Bz doing so, the organization 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 electric current release (with the latest features).
two. After deciding the version, click on theWindows or themacOS Installer, depending on the organization you are using. The system downloads the package and stores it in the specified directory.
3. Once the download is consummate, run the installer.
4. The Node.js Setup Wizard appears and guides you through the installation.
5. Accept the License Agreement by checking the box and click Next.
half-dozen. Cull the destination folder where yous desire to install Node.js.
7. Node.js allows yous to select how you lot want to install the Node features. Modify the way the features are installed past clicking on the icons in the tree.
8. With that, the latest Node.js is prepare to install. Click Install to confirm, expect until the installation completes, and click Finish.
9. Check the Node.js version with the command:
node -five Notation: Sometimes, the system fails to overwrite the older Node.js release and yous may end upwardly with ii versions. If such problems occur, you lot may desire to consider updating with NPM, outlined in the section below.
Option 2: Update Node.js on Windows and macOS with NPM
If you lot want to upgrade Node.js from the command line, use the n model within the npm command. The northward feature allows you to interact with unlike Node.js versions.
1. Before updating the Node.js release, check which version y'all are currently using with:
node -5 2. Side by side, clear npm cache with the command:
npm cache clean -f iii. Install n globally:
npm install -g due north 4. Now that you take n installed, you tin use the module to install the latest stable release of Node.js:
sudo north stable Alternatively, you can install the Node.js release with the latest features:
sudo due north latest Or, install a specific version number with:
n [version.number] Conclusion
The all-time part of open-source engineering science is its strong customs of users constantly working on upgrading the software.
Node.js is a good case of such software as new versions come out regularly. Users can 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 have helped you update Node.js on whatsoever operating system.
Was this article helpful?
Yes No
Source: https://phoenixnap.com/kb/update-node-js-version
Posted by: thomaslenct1938.blogspot.com

0 Response to "How To Upgrade Node In Windows"
Post a Comment