CentOS 7 通过 yum 安装 nodejs 和 npm

  1. 获取nodejs 资源

    # 4.x

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

    # 5.x

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

    # 0.10

    curl --silent --location https://rpm.nodesource.com/setup | bash -

    我这里安装的是 v4.x

    CentOS 7 通过 yum 安装 nodejs 和 npm
    CentOS 7 通过 yum 安装 nodejs 和 npm
  2. 安装

    yum install -y nodejs

    CentOS 7 通过 yum 安装 nodejs 和 npm
    CentOS 7 通过 yum 安装 nodejs 和 npm
  3. 测试是否安装成功

    node -v 

     # v4.4.0

    npm -v

    # 2.14.20

    CentOS 7 通过 yum 安装 nodejs 和 npm
原文地址:https://www.cnblogs.com/chenweixuan/p/5497724.html