Как обновить версию node js windows

Этим вопросом задаются многие новички. Они не знают правильного и эффективного способа, и именно для них наш сегодняшний материал. Стоит отметить, что вариантов, как обновить Node.js достаточно много. Я постараюсь рассмотреть каждый из них в отдельности, включая, кстати, операционные системы, на которых будут производиться нужные действия.

Самым простым и очевидным способом здесь будет использование готового Bash-скрипта для Windows. С его помощью можно не только установить актуальную версию Node.js, но и произвести другие, не менее важные операции. Например, вы можете установить сразу несколько версий Node.js, и переключать их в зависимости от своих потребностей. Реализуется это через специальные команды:

nvm list
 * 4.6.9
   0.17.0

node -v
   v4.6.9

nvm use 0.17.0
   Now using node v0.17.0

node -v
   v0.17.0

Само обновление же можно воспроизвести и с помощью такой последовательности действий:

Очищаем кэш NPM:

npm cache clean -f

Устанавливаем менеджер версий Node.js n:

npm install -g n

Выбираем нужную версию Node.js:

1. Стабильная версия

n stable

2. Последняя версия

n latest

3. Установка определенной версии

n 0.9.17

4. Удаление определенной версии

n rm 0.9.17

или

n - 0.8.14

Помимо всего прочего, вы можете загрузить актуальную версию Node.js на официальном ресурсе Node.js. Там доступны установочные пакеты MSI, архивы zip и tar.gz, также версии для Linux и Mac.

Как обновить Node.js на Windows, Linux и Mac

Другие способы установки и обновления Node.js на Windows

В 2017 году на разных ресурсах описывают еще один, более актуальный способ, который был рекомендован одним из зарубежных “гуру” в своем блоге. Чтобы обновить Node.js нам нужно воспользоваться таким алгоритмом:

Узнаем какую версию Node мы используем:

node --version

Просмотрим доступные для установки версии, а также используемую:

nvm ls

Выведем список доступных версий:

nvm ls available

Установим нужную версию (предположительно 1.1.1):

nvm install 1.1.1

Для включения более старой версии используем команду:

nvm use 0.1

Не могу ничего сказать по поводу эффективности данного метода, однако вы можете самостоятельно проверить его, после чего отписать в комментариях о результате.

Также вы можете использовать этот, самый простой, по моему мнению, способ:

1. Запускаем cmd от имени администратора

2. Последовательно выполняем две команды:

npm install -g npm-windows-upgrade

npm-windows-upgrade

Данный способ рекомендован разработчиками npm, поэтому вам стоит обратить внимание на него.

Как обновить Node.js на Linux

Как и в случае с Windows, здесь мы будем использовать менеджер npm. Здесь он доступен по другому адресу на GitHub. Большая часть команд совпадает с вышеописанными, поэтому вам следует лишь повторить их, предварительно установив NPM на свою версию Linux.

Кстати говоря, если вы используете Arch Linux (или производные дистрибутивы), обновление для Node.js будет установлено автоматически при следующем апгрейде системы.

Как обновить Node.js на Mac

И снова здесь актуален способ с NPM, вы можете использовать абсолютно те же команды, что и для Windows с Linux. Однако сейчас мы рассмотрим альтернативной вариант, подразумевающий работу с менеджером пакетов Homebrew.

После установки вам достаточно будет выполнить одну единственную команду:

$ brew upgrade node

Готово! Node.js обновлена, а вы прекрасны.

В заключение

Какой бы способ вы не выбрали (а я настоятельно рекомендую прочитать и ознакомиться с каждым из них), в большинстве случаев обновление должно пройти успешно. С помощью менеджера пакетов npm можно управлять версия Node.js на Windows, Linux и MacOS. Я не думаю, что у вас возникнут проблемы с этим.

Node.js is one of the most popular development platforms nowadays. It allows developers to create server-side applications using JavaScript. Updating Node versions can be tricky, but it’s crucial for your development environment.

Sr Engineer teaching how to update node versions

Download Now: An Introduction to JavaScript  [Free Guide]

This blog post will take you through updating Node.js on Mac, Windows, and Linux. We’ll also give you some tips to make the process as smooth as possible. First, we’ll discuss why keeping your Node up-to-date is essential.

Let’s get started!

Why is it important to keep Node up-to-date?

Node.js is an open-source platform. New features, bug fixes, and security updates are constantly released. Newer versions of Node.js will have better performance, stability, and security. That’s why it’s essential to keep up-to-date with the latest version of Node

Why update the Node version, if a project already runs smoothly?

Keeping your Node up-to-date ensures your code runs with the latest security and bug fixes and gets access to the latest features. If you don’t keep your Node up-to-date, it could lead to security vulnerabilities and other issues. Even if your code is impeccable, any third-party code integrated into your work — directly or indirectly — can have its own security faults.

Now that we know how important it is to update Node, how do you update it? Let’s look at updating Node on Mac, Windows, and Linux.

There are a few ways to update Node on Mac and Windows. We’ll talk about using a package manager such as NPM or manually downloading the latest version and installing it yourself.  

Using NPM:

To update Node using NPM, do the following:

  1. Open the Terminal and check your current Node version: 
    node -v 
  2. Install n package using the following command:
    npm install -g n   
    This command will install a tool called «n» which you can use to update Node easily.
  3. To update Node, run the following command in your terminal:           
    n latest
    This command will install the latest version of Node on your system.
  4. Now you can verify that your update is complete by rechecking your Node version:  
    node -v

You can also manually download and install the latest Node version from the official website.

How to Update Node Versions on Linux

Updating Node on Linux is a bit different from how it’s done on Windows and Mac. To update Node, you’ll need to use a package manager such as NVM or APT.

Using nvm:  

NVM (Node Version Manager) is a tool that allows you to manage multiple versions of Node on your system. You can use nvm to install, update, and switch between different versions of Node.

To update your version of Node using nvm, do the following:

  1. Check if you already have nvm installed on your system:  
    nvm —version
  2. If it’s not installed, install nvm using this command:    
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  3. Once nvm is installed, check your current version of Node by running the following command:
    node -v
  4. Then update your version of Node using the following command:  
    nvm install node —reinstall-packages-from=node
  5. And finally, verify that your update is complete by rechecking your Node version:  
    node -v

Using APT (Advanced Package Tool):

APT is a package manager for Debian-based Linux distributions such as Ubuntu and Debian. To update Node using APT, do the following:

  1. First, check your current version of Node by running the following command:
    node -v
  2. Then run this command to install the latest version of Node:    
    sudo apt-get install nodejs
  3.  And finally verify that your update is complete by rechecking your Node version:  
    node -v

These are just a few ways to update Node on Mac, Windows, and Linux. Keep in mind that it’s important to keep up-to-date with the latest version of Node not only for security reasons but also to get access to new features and bug fixes.

Tips For Updating Your Node Version

Updating Node versions can be a simple process. Here are some tips to make it easier:

  • Make sure your existing Node version is up to date before upgrading. You may experience issues during the updating process if it still needs to be updated.
  • Test any new features or bug fixes on a development environment before deploying them to production. This will help ensure that everything works as expected before making any changes live.
  • Ensure your development environment is backed up regularly if anything goes wrong during the upgrade process.
  • Keep an eye on the Node release notes for new updates or software changes.

By following these tips and using the above methods, you can ensure that your node version is always up-to-date with the latest features and security patches!     

Final Thoughts on Updating Node Version

The benefits of Node.js is countless. From its easy-to-use environment, modern features, and constant updates, Node is a popular choice for developing applications. Keeping your version of Node up-to-date is important to get the best performance, security, and features out of it. With multiple options available such as Mac, Windows, and Linux,  updating Node is accessible and can be done quickly with just a few steps.

New Call-to-action

Introduction

Node.js is an open-source JavaScript runtime environment. Since Node.js has an active community 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 different JS framework. Either way, make sure to update Node.js regularly to ensure system security.

There are several ways to install Node.js and NPM. Likewise, there are several ways to update your Node.js version, depending on the operating system running on your machine.

In this article, 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 system. Although using the Node Version Manager is the easiest and most recommended option, you can also update with the local package manager or by downloading the binary packages.

Option 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

2. Install NVM using the curl command:

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

Note: If you don’t have curl, install the utility by running the command: sudo apt install curl.

Alternatively, you use 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 terminal for system to recognize the changes or run the command:

source ~/.bashrc

5. Then, verify if you have successfully installed NVM:

nvm --version

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

nvm ls

7. Now you can check for newly available releases with:

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

8. To install the latest version, use the nvm command with the specific Node.js version:

nvm install [version.number]

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

As an alternative, you can use Node’s official package manager to update Node.js. NPM is a tool for installing and managing package dependencies.

If you have Node on your system, you have NPM, as well. With the npm command, you can check running Node.js versions and install the latest release.

By adding the n module, you can interactively manage Node.js versions.

1. First, clear the npm cache:

npm cache clean -f
clear npm cache

2. Install n, Node’s version manager:

npm install -g n

3. With the n module installed, you 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 fix this issue run sudo -E env "PATH=$PATH" [command]. For example, 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 n latest

Install a specific version:

sudo n [version.number]

Option 3: Update Node.js with Binary Packages

Updating Node.js with binary packages is the least recommended option. However, if it is the only way you can upgrade to the latest Node.js version, follow the steps outlined below.

1. Navigate to Node’s official downloads page where you can find all available packages. There you can download the source code or pre-built installer for the LTS versions or the latest release.

2. 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-get install xz-utils

4. 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

Updating Node.js on Windows and macOS follows the same 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 inside the terminal window.

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

One way 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).

2. After deciding the version, click on the Windows or the macOS Installer, depending on the system you are using. The system downloads the package 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 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 you want to install the Node features. Change the way the features are installed by 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 confirm, wait until the installation completes, and click Finish.

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

node -v

Note: Sometimes, the system fails to overwrite the older Node.js release and you may end up with two versions. If such problems occur, you may want to consider updating with NPM, outlined in the section below.

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

If you want to upgrade Node.js from the command line, use the n model within the npm command. The n feature allows you to interact with different Node.js versions.

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

node -v

2. Next, clear npm cache with the command:

npm cache clean -f

3. Install n globally:

npm install -g n

4. Now that you have n installed, you can use the module to install the latest stable release of Node.js:

sudo n stable

Alternatively, you can install the Node.js release with the latest features:

sudo n latest

Or, install a specific version number with:

n [version.number]

Conclusion

The best part of open-source technology is its strong community of users constantly working on upgrading the software.

Node.js is a good example of such software as new versions come out regularly. Users can choose 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 any operating system.

All Platforms (Mac, Linux & Windows) 2023

If you just need to upgrade your old version of Node.js to the latest one and don’t need multiple versions, simply over-write your existing executable with the new one.

Download the Latest Node.js from nodejs.org/en/download

enter image description here

This Just Works! TM on all platforms and is the easiest/fastest method.
When you run node -v in your terminal you will see the the latest version.

Mac

If you originally installed Node.js using brew then run:

brew upgrade node

Managing Multiple Versions of Node.js:

If you need to run multiple versions of Node.js on your machine e.g. if you have an older project that targets a specific version on AWS Lambda, then NVM (Node Version Manger) is your friend!

Step 1 — Get NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

If you’re curious about the installation command read the source code
… its been reviewed by several node.js security experts

Step 2 — Install the Specific Version of Node.js you need

Once you’ve got NVM you can install a specific version of Node.js using the nvm command:

nvm install v18.15.0

Note: you may need to close & re-open your terminal window for nvm command to be available.

You should expect to see something like this in your terminal:

Now using node v18.15.0

You now have the latest Node.js on your machine.
And if you need to temporarily switch to a different/previous version, you can do it with a simple nvm command.

Note: avoid using sudo with Node/NPM as it violates the security principal of least privilege

NVM is considered «better» than N for managing multiple Node.js versions because the verbose commands mean it is much easier to keep track of what you are doing in your Terminal/SSH Log. It is used by the team at NPM the creators/custodians of the Node.js World!

Node.js is a cross-platform JavaScript environment that can be used for server-side scripting. Due to its non-blocking workflow, Node.js is popular among the web developers for building a dynamic web application. Node Package Manager also known as npm is the package manager for Node.js. It also serves as a command-line utility for interacting with the npm online repository for package installation, version management, and dependency management. It is important to have Node.js installed in order to use npm. Also, working with updated versions of Node.js and npm ensures better performance and added features.Stable version of Node.js can be downloaded or updated from the official Node.js website as well as through the command line using Node Version Manager(nvm). nvm was originally developed for Linux systems, however nvm can be installed separately for Windows system by the following steps:

  1. Go to this site: https://github.com/coreybutler/nvm-windows/releases
  2. Install and unzip the nvm-setup.zip file
  3. From cmd type nvm -v to ensure nvm is installed.

After installing nvm, the following can be done to update Node.js to the latest version:

nvm install <version>

 

Check the list of available Node.js version in the system using the following command:

nvm list 

To use the desired version, use the following command:

nvm use <version>

 

Update npm: To update NPM, use the following command:

npm install -g npm

Output:

  

Below is a demonstration for updating Node.js and npm versions for Linux systems. Install nvm in Linux:

# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash OR # wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Check if nvm is installed successfully

Open a new terminal
nvm -v

To install latest version of node, use the following command.

# nvm install node
or
# nvm install --lts
or
# nvm install 

 

Check all the available version of node on the system:

# nvm ls

 

Use a particular version

# nvm use 

 

Update npm to latest version:

# npm install -g npm 

JavaScript is best known for web page development but it is also used in a variety of non-browser environments. You can learn JavaScript from the ground up by following this JavaScript Tutorial and JavaScript Examples.

Last Updated :
10 Nov, 2022

Like Article

Save Article

  • Как обновить билд windows 10
  • Как обновить версию java на windows 10
  • Как обновить базовый видеоадаптер майкрософт windows 10
  • Как обновить ватсап на windows 10
  • Как обновить браузер chrome на компьютере windows