- How to Update Node.JS to Latest Version (Linux, Ubuntu, OSX, Windows, Others)
- How To Update Node.JS Using Node Version Manager (NVM)
- How To Update Node Using a Package Manager
- How to Update Node (Windows/macOS) Using Installers on Nodejs.org
- Как обновить node.js для Windows
- How to Easily Update Node.js to the Latest Version
- Checking your version of Node.js
- 1. Updating using a Node version manager on macOS or Linux
- 2. Updating using a Node version manager on Windows
- 3. Updating using a Node installer on Linux
- 4. Updating using a Node installer on macOS and Windows
- 5. Updating using Homebrew on macOS
- Conclusion
- Alfrick Opidi / About Author
How to Update Node.JS to Latest Version (Linux, Ubuntu, OSX, Windows, Others)
Node.js is very popular nowadays because of it’s feature like:
- JavaScript runtime built on Chrome’s V8 JavaScript engine
- Node.js uses an event-driven, non-blocking I/O model
- Which makes it lightweight and efficient
- Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
Because of these features, Node.Js because very popular in no time and Now its developer’s favorite language for developing Rest APIs and Building high scaling apps.
So, Today in this How to Guide, we will be discussing all the methods for updating NodeJs to Latest version in Linux Os, Ubuntu Os, Windows 7, 8, 10 and Mac Osx using NVM (Node Version Manager) and NPM (Node Package Manager). And At last, we will discuss Best way to update Node.JS
How To Update Node.JS Using Node Version Manager (NVM)
Go to NVM’s official documentation and install the script using curl or wget method.
Verify installation by using the following command,
Steps to update Node.JS using NVM:
When you’re working with multiple Node.Js utilities, sometimes you need some specific Node.js version installed, for this purpose nvm is the best option as we show the procedure below:
and, you can easily switch:
You can check what versions are currently installed with nvm ls and see what is available to install by using nvm ls-remote and you can even set default version using nvm alias default node
If you want to uninstall some version, use nvm uninstall 4.1.2
By NVM can be your Buddy if you’re troubleshooting your node.js app and you need to switch between versions.It has a lot of built-in utilities go and check it’s documentation fellas.
How To Update Node Using a Package Manager
- First Check the version of installed npm using npm -v and then update it to latest version using npm install npm@latest -g
- To update Node, you’ll need npm’s handy n module. Run this code to clear npm’s cache, install n, and install the latest stable version of Node:
- sudo npm cache clean -f sudo npm install -g n sudo n stable
- To install the latest released version, use n latest . Alternatively, you can run n #.#.# to get a specific Node version.
How to Update Node (Windows/macOS) Using Installers on Nodejs.org
- Go to NodeJs Download page, download any release you want and install it using installer for your windows or macOs.
- After installing you can verify, installation using
- npm -v node -v
- And,
You’re done, Now you have successfully installed Node.Js and NPM on your Windows or Mac Os uisng official installers.
Now, Coming to Best way to update Your Node.JS:
The best way is to use NVM, as it provides lot of built-in utilities, which are well documented and tested.
If you get any error during installation or update process, please leave the comment below and we will solve it for you.
Как обновить node.js для Windows
Нехитрый и в тоже время простой способ как можно обновить Node JS на устройстве Windows
Только что обновил у себя Node.js и думаю что стоит об этом записать, чтоб потом долго не тормозить когда буду обновлять в следующий раз.
Всё началось с того, что обновлял пакеты NPM и решил проверить какая версия Node.js у меня установлена. Ввёл в консоле:
Выдало что у меня на компе установлена версия v8.9.1
Посмотрел на оф сайте — а последняя рекомендуемая уже v10.15.1. Прикинул — года полтора я Node.js точно не обновлял. Ну и начал гуглить «Как обновить nodejs. «
Это просто жесть:
Поставьте хрень которая будет обновлять Node.js
Если вы попали сюда тоже из гугля то вероятно только что вы уже натыкались на подобные советы и тоже подумали:
а какую потом хрень ставить чтоб обновить ту хрень которая обновляет Node.js ?
Ещё советчики дают трёхстрочные коды для консоли — ваще ни хренашеньки не понятно. Одна муть и жесть.
Но всё таки я наткнулся и нашёл тот самый дельный совет как обновить у себя нод. Всё вообще банально просто:
Заходим на сайт Node.js и скачиваем последнюю рекомендуемую версию. Закрываем консоль если она открыта и запускаем скачанный установщик Node.js (делаем обычную установку как будто с нуля устанавливаем).
На всё про всё ушло около трёх минут. Пакеты NPM обновляются дольше. Установщик Node.js не дурак, всё сделает как надо.
В общем, теперь у меня стоит последняя версия node.
*** Авторизируйтесь чтобы писать комментарии.
How to Easily Update Node.js to the Latest Version
August 26th, 2020 by Alfrick Opidi
Node.js is a popular open-source, cross-platform server-side environment for building robust applications. Since a vibrant community of contributors backs it, the platform is continuously updated to introduce new features, security patches, and other performance improvements.
So, updating to the latest Node.js version can help you to make the most of the technology. You can decide to work with the Long-term Supported (LTS) version or the Current version that comes with the latest features.
Typically, LTS is recommended for most users because it is a stable version that provides predictable update releases as well as a slower introduction of substantial changes.
In this article, you will learn how to quickly and easily update Node.js on different operating systems—macOS, Linux, and Windows.
As we’ll demonstrate, there are many ways of updating to the next version of Node.js. So, you can choose the option that best meets your system requirements and preferences.
These are the updating options we’ll talk about:
- Updating using a Node version manager on macOS or Linux
- Updating using a Node version manager on Windows
- Updating using a Node installer on Linux
- Updating using a Node installer on macOS and Windows
- Updating using Homebrew on macOS
Checking your version of Node.js
Before getting started, you can check the version of Node.js currently deployed on your system by running the following command on the terminal:
node –version |
or (shortened method):
Let’s now talk about the different ways on how to update Node.js.
1. Updating using a Node version manager on macOS or Linux
A Node version manager is a utility that lets you install different Node.js versions and switch flawlessly between them on your machine. You can also use it to update your version of Node.js.
On macOS or Linux, you can use either of the following Node version managers:
Let’s talk about each of them.
nvm is a script-based version manager for Node.js. To install it on macOS or Linux, you can use either Wget or cURL.
For Wget, run the following command on the terminal:
wget -qO- https: //raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash |
For cURL, run the following:
curl -o- https: //raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash |
The above commands assume that you’re installing nvm version 0.35.3. So, you’ll need to check the latest version before installing it on your machine.
With these commands, you can clone the repository to
/.nvm . This way, you can make changes to your bash profile, allowing you to access nvm system-wide.
To confirm if the installation was successful, you can run the following command:
command -v nvm |
If everything went well, it’d output nvm .
Next, you can simply download and update to the latest Node.js version by running the following:
nvm install node |
Note that node refers to an alias of the latest Node.js version.
You can also reference LTS versions in aliases as well as . nvmrc files using the notation lts/* for the most recent LTS releases.
Here is an example:
nvm install –lts |
If you want to install and upgrade to a specific version, you can run the following:
nvm install |
For example, if you want to update Node.js to version 12.18.3, you can run:
nvm install 12.18.3 |
After the upgrade, you can set that version to be the default version to use throughout your system:
nvm use 12.18.3 |
You can see the list of installed Node.js versions by running this command:
Also, you can see the list of versions available for installation by running this command:
nvm ls-remote |
n is another useful Node version manager you can use for updating Node.js on macOS and Linux.
Since it’s an npm-based package , if you already have Node.js available on your environment, you can simply install it by running this command:
npm install -g n |
Then, to download and update to your desired Node.js version, execute the following:
For example, if you want to update Node.js to version 12.18.3, you can run:
To see a list of your downloaded Node.js versions, run n on its own:
You can specify to update to the newest LTS version by running:
You can also specify to update to the latest current version by running:
You can specify to update to the newest LTS version by running:
n latest |
2. Updating using a Node version manager on Windows
On Windows, you can use the following Node version manager:
Let’s talk about it.
a) nvm-windows
nvm-windows is a Node version management tool for the Windows operating system. While it’s not the same as nvm , both tools share several usage similarities for Node.js version management.
Before installing nvm-windows , it’s recommended to uninstall any available Node.js versions from your machine. This will avoid potential conflict issues during installation.
Next, you can download and run the latest nvm-setup.zip installer.
Also, since the utility runs in an Admin shell, you’ll need to begin the Command Prompt or Powershell as an Administrator before using it.
If you want to install and upgrade to a specific version, you can run the following:
You can specify to update to the newest LTS version by running:
nvm install |
For example, if you want to update Node.js to version 12.18.3, you can run:
nvm install 12.18.3 |
After the upgrade, you can switch to that version:
nvm use 12.18.3 |
You can also specify to update to the latest stable Node.js version:
nvm install latest |
You can see the list of installed Node.js versions by running this command:
nvm list |
Also, you can see the list of versions available for download by running this command:
nvm list available |
3. Updating using a Node installer on Linux
Using a Node installer is the least recommended way of upgrading Node.js on Linux. Nonetheless, if it’s the only route you can use, then follow the following steps:
- Go to the official Node.js downloads site , which has different Linux binary packages, and select your preferred built-in installer or source code. You can choose either the LTS releases or the latest current releases.
- Download the binary package using your browser. Or, you can download it using the following Wget command on the terminal:
- Download the binary package using your browser. Or, you can download it using the following Wget command on the terminal:
wget https: //nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz |
Remember to change the version number on the Wget command depending on the one you want.
- Install the xz-utils utility using the following command:
sudo apt-get install xz-utils |
This utility will be used for unpacking the binary package.
- Finally, run the following command to unpack and install the binary package on usr/local:
tar -C /usr/local -strip-components 1 -xJf node-v12 .18.3 -linux-x64.tar.xz |
4. Updating using a Node installer on macOS and Windows
Another way of updating your Node.js on macOS and Windows is to go to the official download site and install the most recent version. This way, it’ll overwrite your existing old version with the latest one.
You can follow the following steps to update it using this method:
- On the Node.js download page, select either the LTS version or the latest current version.
- Depending on your system, click either the Windows Installer option or the macOS installer option.
- Run the installation wizard. It will magically complete the installation process and upgrade your Node.js version by replacing it with the new, updated one.
5. Updating using Homebrew on macOS
Homebrew is a popular package management utility for macOS.
To use it for installing Node.js, run the following command on your macOS terminal:
brew install node |
Later, if you’d like to update it, run the following commands:
brew update #ensure Homebrew is up to date first |
brew upgrade node |
Furthermore, you can switch between installed Node.js versions:
brew switch node 12.18.3 |
Conclusion
That’s how to upgrade your Node.js version on Linux, macOS, or Windows. With every update of Node.js, you can get enhanced features, increased security, better compatibility with other technologies, and more.
You need to be updating Node.js constantly to improve your development experience and create versatile applications.
Are you letting open-source vulnerabilities go undetected?
WhiteSource Bolt is a powerful free extension that operates in real-time to provide visibility over your open source components within Azure Pipelines or GitHub.
- Get real-time alerts on security vulnerabilities
- Ensure the license compliance of open source components.
- Receive automated open-source inventory reports for every build or project.
Get it now and join thousands of developers who’ve already gained full visibility over their open-source components.
Alfrick Opidi / About Author
Alfrick is an experienced full-stack web developer with a deep interest in taking technical information and converting it into easy to understand content. See him as a technology enthusiast who explores the latest developments in the industry and presents them in a relatable, concise, and decipherable manner.