安装方法来自于

https://nodejs.org/en/download/package-manager/

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.



Arch Linux

Node.js and npm packages are available in the Community Repository.

pacman -S nodejs npm

Debian and Ubuntu based Linux distributions

Also including: Linux Mint, Linux Mint Debian Edition (LMDE), elementaryOS, bash on Windows and others.

Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, for Node.js 9:

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo apt-get install -y build-essential

Available architectures:

  • i386 (32-bit)
  • amd64 (64-bit)
  • armhf (ARM 32-bit hard-float, ARMv7 and up: arm-linux-gnueabihf)

Supported Ubuntu versions:

  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 16.04 LTS (Xenial Xerus)

Supported Debian versions:

  • Debian 7 (wheezy)
  • Debian 8 / stable (jessie)
  • Debian testing (stretch, aliased to jessie)
  • Debian unstable (sid)

A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as "nodejs". It only installs a nodejs binary.

The nodejs-legacy package installs a node symlink that is needed by many modules to build and run correctly. The Node.js modules available in the distribution official repositories do not need it.

Supported Linux Mint versions:

  • Linux Mint 17 "Qiana" (via Ubuntu 14.04 LTS)
  • Linux Mint 17.1 "Rebecca" (via Ubuntu 14.04 LTS)
  • Linux Mint 17.2 "Rafaela" (via Ubuntu 14.04 LTS)
  • Linux Mint Debian Edition (LMDE) 2 "Betsy" (via Debian 8)

Supported elementary OS versions:

  • elementary OS Freya (via Ubuntu 14.04 LTS)

Supported Trisquel versions:

  • Trisquel 7 "Belenos" (via Ubuntu 14.04 LTS)

Supported BOSS versions:

  • BOSS 5.0 "Anokha" (via Debian 7)

Enterprise Linux and Fedora

Including Red Hat® Enterprise Linux® / RHEL, CentOS and Fedora.

Node.js is available from the NodeSource Enterprise Linux and Fedora binary distributions repository. Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.

On RHEL, CentOS or Fedora, for Node.js v6 LTS:

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

Alternatively for Node.js 9:

curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -

Then install:

sudo yum -y install nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo yum install gcc-c++ make
# or: sudo yum groupinstall 'Development Tools'

Available architectures:

  • i386 (32-bit, not available for EL7)
  • x86_64 (64-bit)

Supported Red Hat® Enterprise Linux® versions:

  • RHEL 5 (32-bit and 64-bit)
  • RHEL 6 (32-bit and 64-bit)
  • RHEL 7 (64-bit)

Supported CentOS versions:

  • CentOS 5 (32-bit and 64-bit)
  • CentOS 6 (32-bit and 64-bit)
  • CentOS 7 (64-bit)

Supported CloudLinux versions:

  • CloudLinux 6 (32-bit and 64-bit)

Supported Fedora versions:

  • Fedora 21 (Twenty One) (32-bit and 64-bit)
  • Fedora 20 (Heisenbug) (32-bit and 64-bit)
  • Fedora 19 (Schrödinger's Cat) (32-bit and 64-bit)

Other distributions known to be supported:

  • Oracle Linux (mirrors RHEL very closely)
  • Amazon Linux (tested on 2016.03)

Alternatives

Official Fedora Node.js and npm packages are available in Fedora 18 and later. Install with:

sudo dnf install nodejs

In a hurry for the latest updates? Grab them from updates-testing.

Enterprise Linux (RHEL and CentOS) users may use the Node.js and npm packages from the EPEL repository.

Install the appropriate epel-release RPM for your version (found on the EPEL repository homepage), then run:

sudo yum install nodejs npm --enablerepo=epel

In a hurry for the latest updates? Grab them from epel-testing.

Available architectures:

  • i686 (32-bit, not available for EL7)
  • x86_64 (64-bit)
  • armv6hl (Raspberry Pi, Pidora only)
  • armv7hl (32-bit ARM hard-float, ARMv7 and up, Fedora only)

Supported Red Hat® Enterprise Linux® versions:

  • RHEL 6 (i686/x86_64)
  • RHEL 7 (x86_64)

RHEL 6 is no longer supported through EPEL, you can however use Red Hat Software Collections.

Additionally, versions of CentOS and Scientific Linux corresponding to the above RHEL versions are also officially supported by all EPEL packages, including nodejs. Amazon Linux is not officially supported by EPEL due to significant incompatibilities previously reported to the epel-devel mailing list, however you might find that nodejs at least still works.

Supported Fedora versions:

  • Fedora Rawhide (i686/x86_64/armv7hl/aarch64/ppc64/ppc64le/s390x)
  • Fedora 26 (i686/x86_64/armv7hl/aarch64/ppc64/ppc64le)
  • Fedora 25 (i686/x86_64/armv7hl)
  • Fedora 24 (i686/x86_64/armv7hl)

FreeBSD and OpenBSD

Node.js is available through the ports system.

FreeBSD:

/usr/ports/www/node

OpenBSD:

/usr/ports/lang/node

Development versions are also available using ports on FreeBSD

cd /usr/ports/www/node-devel/ && make install clean

Or packages on FreeBSD:

pkg_add -r node-devel

Using pkg-ng on FreeBSD

pkg install node

Or the development versions:

pkg install node-devel

Using pkg_add on OpenBSD

pkg_add node

Gentoo

Node.js is available in the portage tree.

emerge nodejs

NetBSD

Node.js is available in the pkgsrc tree:

cd /usr/pkgsrc/lang/nodejs && make install

Or install a binary package (if available for your platform) using pkgin:

pkgin -y install nodejs

nvm

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:

$ env VERSION=`python tools/getnodeversion.py` make install DESTDIR=`nvm_version_path v$VERSION` PREFIX=""

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:

$ nvm use 8

Once the official release is out you will want to uninstall the version built from source:

$ nvm uninstall 8

openSUSE and SLE

Node.js is available in the main repositories under the following packages:

  • openSUSE Leap 42.2: nodejs4
  • openSUSE Leap 42.3: nodejs4, nodejs6
  • openSUSE Tumbleweed: nodejs4, nodejs6, nodejs8
  • SUSE Linux Enterprise Server (SLES) 121: nodejs4, nodejs6

1: The "Web and Scripting Module" must be added before installing.

For example, to install Node.js 4.x on openSUSE Leap 42.2, run the following as root:

zypper install nodejs4

macOS

Simply download the Macintosh Installer direct from the nodejs.org web site.

If you want to download the package with bash:

curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"

Alternatives

Using Homebrew:

brew install node

Using MacPorts:

port install nodejs<major version>

# Example
port install nodejs7

Using pkgsrc:

Install the binary package:

pkgin -y install nodejs

Or build manually from pkgsrc:

cd pkgsrc/lang/nodejs && bmake install

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:

pkgin -y install nodejs

Or build manually from pkgsrc:

cd pkgsrc/lang/nodejs && bmake install

Void Linux

Void Linux ships node.js stable in the main repository.

xbps-install -Sy nodejs

Windows

Simply download the Windows Installer directly from the nodejs.org web site.

Alternatives

Using Chocolatey:

cinst nodejs
# or for full install with npm
cinst nodejs.install

Using Scoop:

scoop install nodejs

node 的安装的更多相关文章

  1. node在安装完成后,出现node不是内部或外部命令

    node在安装完成后,查看node版本 node -v出现"node不是内部或外部命令"郁闷. 各种搜索之后,处理好了问题了. 一张图解决问题.

  2. Node.js 安装 初体验(1)

    1.安装nodejs http://nodejs.org/download/  自动根据系统下载自己的版本node.js 2.环境变量 windows 安装,不需要配置环境变量   mac安装后,会提 ...

  3. Windows平台下的node.js安装

    Windows平台下的node.js安装 直接去nodejs的官网http://nodejs.org/上下载nodejs安装程序,双击安装就可以了 测试安装是否成功: 在命令行输入 node –v 应 ...

  4. node环境安装(mac版和windows版)

    WINDOWS版本安装 nvm 是 Mac 下的 node 管理工具,有点类似管理 Ruby 的 rvm,如果是需要管理 Windows 下的 node,官方推荐是使用 nvmw 或 nvm-wind ...

  5. Node.js 安装配置介绍

    Node.js 安装配置 本章节我们将向大家介绍在window和Linux上安装Node.js的方法. 本安装教程以Node.js v6.10.1 LTS(长期支持版本)版本为例. Node.js安装 ...

  6. Node.js安装及环境配置之Windows篇

    Node.js安装及环境配置之Windows篇   一.安装环境 1.本机系统:Windows 10 Pro(64位)2.Node.js:v6.9.2LTS(64位) 二.安装Node.js步骤 1. ...

  7. windows系统下安装 node.js (node.js安装及环境配置)

    node.js简介 Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效. Node. ...

  8. 理解Node.js安装及模块化

    1.安装Node Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效. Node.j ...

  9. Vue框架下的node.js安装教程

    Vue框架下的node.js安装教程 python服务器.php  ->aphche.java ->tomcat.   iis -->它是一个可以运行JAVASCRIPTR 的运行环 ...

  10. Node.js学习(第一章:Node.js安装和模块化理解)

    Node.js安装和简单使用 安装方法 简单的安装方式是直接官网下载,然后本地安装即可.官网地址:nodejs.org Windows系统下,选择和系统版本匹配的.msi后缀的安装文件.Mac OS ...

随机推荐

  1. Percona-XtraBackup系列二:备份恢复

    #在备份较大数据量的时候推荐xtrabackup,这个工具比mysqldump要快很多. 一.Xtrabackup介绍 1,Xtrabackup是什么 Xtrabackup是一个对InnoDB做数据备 ...

  2. window批处理杀死指定端口进程

    @echo off setlocal enabledelayedexpansion set /p port=请输入端口号: for /f "tokens=1-5" %%a in ( ...

  3. java 如何使用多线程调用类的静态方法?

      1.情景展示 静态方法内部实现:将指定内容生成图片格式的二维码: 如何通过多线程实现? 2.分析 之所以采用多线程,是为了节省时间 3.解决方案 准备工作 logo文件 将生成的文件保存在F盘te ...

  4. Java通过mysql-connector-java-8.0.11连接MySQL Server 8.0遇到的几个问题

    这次新安装了一个MySQL数据库,然后navicat连接数据库一点问题没有. 但是通过Java的jdbc连接却怎么都建立不了连接. 报如下错: 网上找了很久找到了原因: 数据库用的是Mysql8版本, ...

  5. ArcGIS10.1正式版全套下载、安装与破解(附ArcGIS10.1全套下载地址)【转】

    一.准备文件1.ArcGIS10.1安装包:ArcGIS_Desktop_10.1_129026(en)2.认证服务:Pre-release_license_manager3.注册机:arcgis10 ...

  6. MySQL与OLAP:分析型SQL查询最佳实践探索

    搞点多维分析,糙快猛的解决方式就是使用ROLAP(关系型OLAP)了.数据经维度建模后存储在MySQL,ROLAP引擎(比方开源的Mondrian)负责将OLAP请求转化为SQL语句提交给数据库.OL ...

  7. 【CAS单点登录视频教程】 第04集 -- tomcat下配置https环境

    目录 ----------------------------------------- [CAS单点登录视频教程] 第06集[完] -- Cas认证 学习 票据认证FormsAuthenticati ...

  8. Mac巧用AirDrop实现大文件传输

    最近想更新一下Xcode8.3,无奈资源太大,不想一点点下载了,公司服务器上正好有官网下载好的,就想直接拿过来使用,本来想通过QQ传输的,无奈发现QQ传输提示资源过大. 于是就想到了这货:AirDro ...

  9. <转>赋值表达式解析的流程

    转自:http://www.cnblogs.com/nazhizq/p/6520072.html 上节说到表达式的解析问题,exprstate函数用于解析普通的赋值表达式.lua语言支持多变量赋值.本 ...

  10. Lua编程笔记

    迭代器并没有真正的迭代,真正迭代的是for循环.而迭代器为每次迭代提供成功后的返回值. function allwords(f)for line in io.lines do for word in ...