- 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 в Debian 10 Linux
- Установка Node.js и npm из репозиториев Debian
- Установка Node.js и npm из репозитория NodeSource
- Установка Node.js и npm с помощью NVM
- Установка средств разработки
- Удаление Node.js
- Выводы
- Как установить Node.js и npm на Debian 9
- Установите Node.js и NPM из репозитория NodeSource
- Установите Node.js и NPM с помощью NVM
- Установить инструменты разработки
- Удалите Node.js
- Выводы
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 в Debian 10 Linux
Node.js — это кроссплатформенная среда выполнения JavaScript, построенная на JavaScript в Chrome и предназначенная для выполнения кода JavaScript на стороне сервера. С помощью Node.js вы можете создавать масштабируемые сетевые приложения.
npm — это менеджер пакетов по умолчанию для Node.js, который помогает разработчикам делиться и повторно использовать свой код.
В этом руководстве мы покажем вам несколько различных способов установки Node.js и npm на Debian 10 Buster. Выберите вариант установки, подходящий для вашей среды.
Установка Node.js и npm из репозиториев Debian
Node.js и npm можно установить из стандартных репозиториев Debian. На момент написания в репозиториях была версия v10.x, которая является последней версией LTS.
Чтобы установить Node.js и npm на ваш Debian, используйте следующие команды:
Когда установка будет завершена, проверьте ее, набрав:
Команда отобразит версию Node.js:
Это самый простой способ установить Node.js и npm в Debian, и его должно хватить для большинства случаев использования.
Установка Node.js и npm из репозитория NodeSource
NodeSource — это компания, специализирующаяся на предоставлении поддержки узлов корпоративного уровня. Он поддерживает репозиторий APT, содержащий несколько версий Node.js.
Используйте этот репозиторий, если вам нужно установить определенную версию Node.js. На момент написания репозиторий NodeSource предоставляет следующие версии:
- v14.x — последняя стабильная версия.
- v13.x
- v12.x — последняя LTS-версия.
- v10.x — предыдущая версия LTS.
Мы установим Node.js версии 12.x.
Начните с добавления репозитория NodeSource в вашу систему, выполнив следующую команду curl :
После добавления репозитория для установки Node.js введите npm:
Убедитесь, что Node.js правильно установлен, набрав:
Установка Node.js и npm с помощью NVM
NVM (Node Version Manager) — это сценарий bash, который позволяет управлять несколькими версиями Node.js. С помощью NVM вы можете установить и удалить любую версию Node.js, которую хотите использовать или протестировать.
Используйте этот метод, если вы хотите установить Node.js для каждого пользователя.
Чтобы установить NVM в вашей системе, введите команду ниже. Не используйте sudo как он активирует сценарий для пользователя root.
Сценарий установки клонирует репозиторий nvm из Github в каталог
/.nvm и добавляет путь nvm к вашему профилю Bash или ZSH.
Чтобы начать использовать сценарий nvm, откройте новый сеанс оболочки или выполните команды, напечатанные на экране. Делай то, что тебе легче.
Теперь, nvm сценарий nvm установлен в вашей системе Debian, вы можете установить последнюю стабильную версию Node.js с помощью:
Установим еще две версии, последнюю версию LTS и версию 8.16.0:
После этого, чтобы перечислить все установленные версии Node.js, введите:
Запись со стрелкой справа (-> v8.16.0) — это версия, используемая в текущем сеансе оболочки, а версия по умолчанию установлена на v12.8.1 . Версия по умолчанию — это версия, которая будет использоваться при открытии новых сеансов оболочки.
Если вы хотите изменить текущую активную версию, скажем, до v10.16.2, вы должны запустить:
Чтобы изменить Node.js по умолчанию, например, на v10.16.2 используйте:
Установка средств разработки
Инструменты разработки необходимы для компиляции и установки собственных надстроек из реестра npm. Установите пакет, запустив:
Удаление Node.js
Если по каким-либо причинам вы хотите удалить пакеты Node.js и npm, используйте следующую команду:
Выводы
Мы показали вам три различных способа установки Node.js и npm в вашу систему Debian 10. Выбор метода зависит от ваших требований и предпочтений.
Теперь, когда вы установили Node.js в свою систему Debian 10, пришло время развернуть ваше приложение.
Если вы хотите использовать Yarn для управления зависимостями вашего приложения, ознакомьтесь с нашим руководством о том, как установить и использовать yarn в Debian 10 .
Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.
Источник
Как установить Node.js и npm на Debian 9
Node.js — это кроссплатформенная среда выполнения JavaScript с открытым исходным кодом, построенная на движке JavaScript Chrome, которая позволяет выполнять код JavaScript на стороне сервера. Он в основном используется для создания серверных приложений, но также очень популярен как полнофункциональное и интерфейсное решение. npm — это менеджер пакетов по умолчанию для Node.js и крупнейшего в мире реестра программного обеспечения.
В этом руководстве мы расскажем, как установить Node.js и npm в Debian 9. Мы покажем вам два разных способа установки Node.js в Debian. Выберите наиболее удобный для вас вариант установки.
Установите Node.js и NPM из репозитория NodeSource
Самый простой способ установить последние версии Node.js и npm — это установить пакет из репозитория, поддерживаемого NodeSource.
Чтобы добавить репозиторий NodeSource в вашу систему, выполните следующую команду:
После добавления репозитория NodeSource установите Node.js и npm с помощью следующей команды:
Чтобы проверить успешность установки, распечатайте версии Node.js и npm:
Установите Node.js и NPM с помощью NVM
NVM (Node Version Manager) — это сценарий bash, который позволяет управлять несколькими версиями Node.js. С помощью NVM вы можете установить и удалить любую конкретную версию Node.js, которую хотите использовать или протестировать.
Загрузите сценарий установки nvm с помощью следующей команды curl :
Сценарий установки клонирует репозиторий nvm из Github в каталог
/.nvm и добавляет путь nvm к вашему профилю Bash или ZSH.
Как nvm из выходных данных, вы можете либо открыть новый сеанс оболочки, либо запустить команды, чтобы добавить путь к сценарию nvm в текущий сеанс. Делай то, что тебе легче.
Чтобы убедиться, что nvm установлен правильно, введите:
Теперь, nvm на вашем компьютере Debian установлен nvm , для установки последней доступной версии Node.js введите:
Проверьте версию Node.js, набрав:
Установим еще две версии, последнюю версию LTS и версию 6.14.3:
После установки версии LTS и 6.14.3 мы можем просмотреть список установленных экземпляров Node.js, набрав:
В выходных данных выше запись со стрелкой справа (-> v6.14.3) — это версия, используемая в текущем сеансе оболочки, а версия по умолчанию установлена на v10.5.0 .
Версия по умолчанию — это версия, которая будет использоваться при открытии новых сеансов оболочки.
Если вы хотите изменить текущую активную версию, используйте следующую команду:
и проверьте это, набрав:
Чтобы установить версию 8.11.3 в качестве типа версии Node.js по умолчанию:
Установить инструменты разработки
Для компиляции и установки собственных надстроек из реестра npm вам необходимо установить инструменты разработки.
Удалите Node.js
Если по каким-то причинам вы хотите удалить пакеты Node.js и npm, вы можете использовать следующую команду:
Выводы
Мы показали вам два разных способа установки Node.js и npm на ваш сервер Debian 9. Выбор метода зависит от ваших требований и предпочтений. Несмотря на то, что установка упакованной версии из репозитория NodeSource проще, метод nvm дает вам больше гибкости для добавления и удаления различных версий Node.js для каждого пользователя.
Теперь, когда вы установили Node.js в свою систему Debian 9, пора приступить к разработке вашего приложения!
Если вы хотите управлять своими пакетами npm с помощью yarn, вы можете проверить это руководство о том, как установить и использовать yarn в Debian 9 .
Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.
Источник