【问题标题】:How to install nodejs on redhat 6如何在红帽 6 上安装 nodejs
【发布时间】:2020-08-05 23:54:36
【问题描述】:

我正在尝试在我的以下 linux 服务器上安装 nodejs(实际上我不太确定是什么版本,但看起来不像企业版):

Linux 版本 2.6.32-042stab090.5 (root@kbuild-rh6-x64) (gcc 版本 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)) #1 SMP Sat Jun 21 00:15 :09 MSK 2014

我运行了这个:

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

遇到了这个问题:

## Installing the NodeSource Node.js 4.x LTS Argon repo...
## Inspecting system...
## You don't appear to be running an Enterprise Linux based system, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support.

【问题讨论】:

    标签: linux node.js npm redhat


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      您可以使用 NVM,即节点版本管理器 (https://github.com/nvm-sh/nvm)

      免责声明:我仅在 Centos7 Docker 容器上进行了测试(不在 RHEL 上):

      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
      . "$HOME/.nvm/nvm.sh"
      nvm ls-remote
      

      输出(当前):

               v4.9.1   (Latest LTS: Argon)
              v6.17.1   (Latest LTS: Boron)
              v8.17.0   (Latest LTS: Carbon)
             v10.22.0   (Latest LTS: Dubnium)
             v12.18.3   (Latest LTS: Erbium)
      

      选择并安装最新的 LTS 版本之一:

      nvm install v12.18.3
      

      检查:

      node -v
      # output: v12.18.3
      
      npm -v
      # output: 6.14.6
      

      或者:安装最新的 LTS 版本

      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
      . "$HOME/.nvm/nvm.sh"
      LATEST_LTS=$(nvm ls-remote | grep "Latest LTS" | sed 's/^[^v]*\(v[0-9\.]*\)[^0-9].*$/\1/' | tail -1)
      nvm install $LATEST_LTS
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-06-07
        • 2014-04-14
        • 2012-09-29
        • 1970-01-01
        • 2017-08-20
        • 2016-05-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多