我正在尝试在我的后续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.
答案 0 :(得分:0)
答案 1 :(得分:0)
您可以使用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