简体   繁体   中英

How to install nodejs on redhat 6

I am trying to install nodejs on my following linux server (actually im not quite sure what version but doesnt look like enterprise):

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

I ran this:

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

And had this problem:

## 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.

You can use NVM, the Node Version Manager ( https://github.com/nvm-sh/nvm )

Disclaimer: I have tested this on a Centos7 Docker container only (not on RHEL):

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

Output (currently):

         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)

Choose and install one of the latest LTS versions:

nvm install v12.18.3

Check:

node -v
# output: v12.18.3

npm -v
# output: 6.14.6

Alternatively: Install the latest LTS Version

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM