- Installing Node.js via package manager
- Android
- Arch Linux
- CentOS, Fedora and Red Hat Enterprise Linux
- Alternatives
- Debian and Ubuntu based Linux distributions
- Alternatives
- FreeBSD
- Gentoo
- IBM i
- macOS
- Alternatives
- NetBSD
- Nodenv
- Windows
- macOS,UnixLike
- Usage
- OpenBSD
- openSUSE and SLE
- SmartOS and illumos
- Solus
- Void Linux
- Windows
- Alternatives
- Установка последних версий Node.js и NPM в Linux
- Шаг 1: Добавление репозитория NodeSource
- Шаг 2: Установка последних Nodejs и NPM
- Шаг 3: Тестирование последних Nodejs и NPM
- 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
- How to Update Node.js on Linux, macOS, and Windows
- Before You Begin
- Updating the Node.js version using NPM
- Updating the Node.js version using NVM
- Updating the Node.js version on macOS
- Using Homebrew
- Using the Node.js Installer
- Updating the Node.js version on Windows
- Using Chocolatey
- Using the Node.js Installer
- More Information
Installing Node.js via package manager
Note: The packages on this page are maintained and supported by their respective packagers, not the Node.js core team. Please report any issues you encounter to the package maintainer. If it turns out your issue is a bug in Node.js itself, the maintainer will report the issue upstream.
Android
Android support is still experimental in Node.js, so precompiled binaries are not yet provided by Node.js developers.
However, there are some third-party solutions. For example, Termux community provides terminal emulator and Linux environment for Android, as well as own package manager and extensive collection of many precompiled applications. This command in Termux app will install the last available Node.js version:
Currently, Termux Node.js binaries are linked against system-icu (depending on libicu package).
Arch Linux
Node.js and npm packages are available in the Community Repository.
CentOS, Fedora and Red Hat Enterprise Linux
Node.js is available as a module called nodejs in CentOS/RHEL 8 and Fedora.
where corresponds to the major version of Node.js. To see a list of available streams:
For example, to install Node.js 12:
For CentOS/RHEL 7 Node.js is available via Software Collections.
Alternatives
These resources provide packages compatible with CentOS, Fedora, and RHEL.
Debian and Ubuntu based Linux distributions
Alternatives
Packages compatible with Debian and Ubuntu based Linux distributions are available via Node.js snaps.
Fast and simple Node.js version manager built in Rust used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch Node versions automatically based on the current directory, etc. To install fnm, use this install script.
fnm has cross-platform support (macOS, Windows, Linux) & all popular shells (Bash, Zsh, Fish, PowerShell, Windows Command Line Prompt). fnm is built with speed in mind and compatibility support for .node-version and .nvmrc files.
FreeBSD
The most recent release of Node.js is available via the www/node port.
Install a binary package via pkg:
Or compile it on your own using ports:
Gentoo
Node.js is available in the portage tree.
IBM i
LTS versions of Node.js are available from IBM, and are available via the ‘yum’ package manager. The package name is nodejs followed by the major version number (for instance, nodejs12 , nodejs14 etc)
To install Node.js 14.x from the command line, run the following as a user with *ALLOBJ special authority:
Node.js can also be installed with the IBM i Access Client Solutions product. See this support document for more details
macOS
Download the macOS Installer directly from the nodejs.org web site.
If you want to download the package with bash:
Alternatives
Using Homebrew:
Using MacPorts:
Using pkgsrc:
Install the binary package:
Or build manually from pkgsrc:
n is a simple to use Node.js version manager for Mac and Linux. Specify the target version to install using a rich syntax, or select from a menu of previously downloaded versions. The versions are installed system-wide or user-wide, and for more targeted use you can run a version directly from the cached downloads.
See the homepage for install methods (boostrap, npm, Homebrew, third-party), and all the usage details.
If you already have npm then installing n and then the newest LTS node version is as simple as:
NetBSD
Node.js is available in the pkgsrc tree:
Or install a binary package (if available for your platform) using pkgin:
Nodenv
nodenv is a lightweight node version manager, similar to nvm . It’s simple and predictable. A rich plugin ecosystem lets you tailor it to suit your needs. Use nodenv to pick a Node version for your application and guarantee that your development environment matches production.
Nodenv installation instructions are maintained on its Github page. Please visit that page to ensure you’re following the latest version of the installation steps.
Node Version Manager is a bash script used to manage multiple released Node.js versions. It allows you to perform operations like install, uninstall, switch version, etc. To install nvm, use this install script.
On Unix / OS X systems Node.js built from source can be installed using nvm by installing into the location that nvm expects:
After this you can use nvm to switch between released versions and versions built from source. For example, if the version of Node.js is v8.0.0-pre:
Once the official release is out you will want to uninstall the version built from source:
Windows
The nvs version manager is cross-platform and can be used on Windows, macOS, and Unix-like systems
To install nvs on Windows go to the release page here and download the MSI installer file of the latest release.
You can also use chocolatey to install it:
macOS,UnixLike
You can find the documentation regarding the installation steps of nvs in macOS/Unix-like systems here
Usage
After this you can use nvs to switch between different versions of node.
To add the latest version of node:
Or to add the latest LTS version of node:
Then run the nvs use command to add a version of node to your PATH for the current shell:
To add it to PATH permanently, use nvs link :
OpenBSD
Node.js is available through the ports system.
Using pkg_add on OpenBSD:
openSUSE and SLE
Node.js is available in the main repositories under the following packages:
- openSUSE Leap 15.2: nodejs10 , nodejs12 , nodejs14
- openSUSE Tumbleweed: nodejs16
- SUSE Linux Enterprise Server (SLES) 12: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)
- SUSE Linux Enterprise Server (SLES) 15 SP2: nodejs10 , nodejs12 , and nodejs14 (The «Web and Scripting Module» must be enabled.)
For example, to install Node.js 14.x on openSUSE Leap 15.2, run the following as root:
Different major versions of Node can be installed and used concurrently.
SmartOS and illumos
SmartOS images come with pkgsrc pre-installed. On other illumos distributions, first install pkgsrc, then you may install the binary package as normal:
Or build manually from pkgsrc:
Node.js snaps are available as node on the Snap store.
Solus
Solus provides Node.js in its main repository.
Void Linux
Void Linux ships Node.js stable in the main repository.
Windows
Download the Windows Installer directly from the nodejs.org web site.
Alternatives
Using Chocolatey:
Using Scoop:
IBM® SDK for Node.js — z/OS® is available in two installation formats, SMP/E and PAX. Select the installation format that applies to you:
В© OpenJS Foundation. All Rights Reserved. Portions of this site originally В© Joyent.
Источник
Установка последних версий Node.js и NPM в Linux
В этой инструкции будет показано, как установить последнюю версию Nodejs и NPM в дистрибутивы Debian/Ubuntu/Linux Mint, RHEL/CentOS и Fedora.
Nodejs – это лёгкая и эффективная платформа JavaScript, которая построена на основе движка Chrome V8 JavaScript, а NPM – это стандартный менеджер пакетов в NodeJS. Вы можете использовать их для построения масштабируемых сетевых приложений.
Шаг 1: Добавление репозитория NodeSource
В стандартных репозиториях вашего дистрибутива могут иметься Node.js и NPM. Но обычно это достаточно старые версии. Свежие версии Node.js и NPM доступны в официальном репозитории бинарных файлов NodeSource дистрибутивов Enterprise Linux, Fedora, Debian и Ubuntu, которые поддерживаются командой Nodejs. Вам нужно добавить этот источник приложений в вашу систему, чтобы иметь возможность установить последние пакеты Nodejs и NPM.
Важно: Ниже RHEL 5 и CentOS 5, пакеты Node.js зависят от репозитория EPEL, скрипт сделает проверку и в случае, если он не установлен, будут предоставлены инструкции.
Для добавления репозитория для последних версий Node.js v6 LTS используйте следующую команду как рут:
На RHEL, CentOS и Fedora:
На Debian:
На Ubuntu и Linux Mint:
Шаг 2: Установка последних Nodejs и NPM
Теперь вы можете установить на вашу систему Nodejs и NPM используя следующую команду:
На RHEL, CentOS и Fedora
На Debian, Ubuntu и Linux Mint
Опционально: на вашей систему нужны инструменты разработчика, такие как gcc-c++ и make чтобы собирать нативные дополнения из npm.
Для установки nodejs на Arch Linux выполните команду:
Шаг 3: Тестирование последних Nodejs и NPM
В качестве простейшего теста вы можете проверить версии nodejs и NPM следующими командами:
На RHEL, CentOS и Fedora
На Debian, Ubuntu и Linux Mint
Для выполнения комплексного теста имеется специальный скрипт, вы можете запустить его следующим образом:
Вот и всё, теперь Nodejs и NPM установлены и готовы для использования в вашей системе.
Источник
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.
Источник
How to Update Node.js on Linux, macOS, and Windows
Node.js is a cross-platform runtime environment for server-side JavaScript applications. Node.js uses the V8 JavaScript engine and is very popular. It is regularly updated for security and improvements, and should be kept updated on your systems.
Before You Begin
This guide assumes you are already running Node.js on your Linode or local workstation and are updating the version. If you don’t have it installed, see the How to Install Node.js guide.
Install NPM, which installs by default with Node.js.
This guide assumes you are only updating your version of Node.js and aren’t looking to run multiple versions. If you do, see the guide How to Install and Use the Node Version Manager.
Update your Linode’s system: sudo apt-get update && sudo apt-get upgrade
Update your local workstation’s system using the tools and package managers for the operating system.
If you’re using the installer to update, go to the Node.js downloads page to get the appropriate version. The most recent version of long-term support (LTS) is listed and you also have the option to choose a version in the Current section.
Updating the Node.js version using NPM
NPM is installed by default with Node.js and is the easiest way to update to any new version on Linux, macOS, or Windows when you do not need to use multiple versions.
Open the Terminal on Linux or macOS. On Windows, launch the Windows PowerShell as an administrator. Search for it in the search bar and then either right-click or click on the arrow to the right and choose Run as Administrator.
Enter the command npm install -g n to install the n module, a Node.js version manager.
Now that n is installed, enter n stable in the Terminal or PowerShell to install the stable version of Node.js
- You can also use n latest for the most recent version, or n [version number] if you have a specific version you need to install.
Agree to any prompts that appears.
When the installation is complete, check the version installed with node -v .
Close the Terminal or PowerShell when finished.
Updating the Node.js version using NVM
If you need to install NVM, see our guide How to Install and Use the Node Version Manager. It’s a useful tool to have, especially in a development environment or if you have to use multiple versions of Node.js.
Open the Terminal on Linux or macOS. On Windows, launch the Windows PowerShell as an administrator. Search for it in the search bar and then either right-click or click on the arrow to the right and choose Run as Administrator.
If you only need the most recent stable version, enter the command nvm ls stable .
- If you need something other than the stable version: a. Enter the command nvm ls to check what version you have. d. Enter the command nvm ls -remote to see what versions are available. Note the one you need. c. Enter the command nvm install [version number]
Agree to any prompts that appears.
When the installation is complete, check the version installed with nvm ls .
Close the Terminal or PowerShell when finished.
Updating the Node.js version on macOS
Using Homebrew
If you installed Node.js using Homebrew, then updating is easy.
Open the Terminal.
Enter the command brew update and agree to any prompts.
Enter the command brew upgrade node and agree to any prompts.
Quit the Terminal when finished.
Using the Node.js Installer
Open the installer from your Downloads folder and click Continue.
If you agree with it, accept the license by clicking Continue and Agree.
If you need to change the installation location, do so. Also, if you want to customize the installation, choose Customize. Linode recommends using the Standard Installation. Click Continue.
The installation is finished. Click Close and macOS moves the installer to the Trash.
Updating the Node.js version on Windows
Using Chocolatey
Assuming you installed Chocolatey when originally installing Node.js, updating should move quickly. Otherwise, update using the following installer instructions.
Launch the Windows PowerShell as an administrator. Search for it in the search bar and then either right-click or click on the arrow to the right and choose Run as Administrator.
When the command prompt loads, enter the following command:
Accept any prompts that requires permission.
Close PowerShell when finished.
Using the Node.js Installer
Open the installer from your Downloads folder and click Next.
If you agree with it, accept the license by checking the box next to I accept the terms in the License Agreement and click Next.
If you need to change the installation location, do so now and click Next.
Choose the packages to install Linode recommends all of them, which is the default. You are prompted to check a box to Automatically install the necessary tools. Do so and click Next.
After installation is complete move the installer to the Recycle Bin.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on Thursday, September 9, 2021.
Источник