linux安装nodejs和yarn

 admin   2022-10-13 10:52   193 人阅读  0 条评论

rpm包

Installation instructions

NOTE: If you are using RHEL 6 or CentOS 6, you might want to read about running Node.js on older distros.

The Nodesource RPM package signing key is available here: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL

Run on RHEL, CentOS, CloudLinux, Amazon Linux or Fedora:

Node.js v18.x

As root
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -

No root privileges
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -

Node.js v16.x

As root
curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -

No root privileges
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -

Node.js v14.x

As root
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -

No root privileges
curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash -

Node.js LTS (16.x)

As root
curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -

No root privileges
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -

Node.js Current (18.x)

As root
curl -fsSL https://rpm.nodesource.com/setup_current.x | bash -

No root privileges
curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -

Optional: install build tools

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

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

图片.png

图片.png

Uninstall nodejs Enterprise Linux packages

To completely remove Node.js installed from the rpm.nodesource.com package methods above:

use sudo or run this as root

yum remove nodejs &&\ rm -r /etc/yum.repos.d/nodesource*.repo &&\ yum clean all

ded包

Installation instructions

Node.js v18.x:

Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\
apt-get install -y nodejs

Node.js v16.x:

Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
apt-get install -y nodejs

Node.js v14.x:

Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
# Using Debian, as rootcurl -fsSL https://deb.nodesource.com/setup_14.x | bash - &&\
apt-get install -y nodejs

Node.js LTS (v16.x):

Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
apt-get install -y nodejs

Node.js Current (v18.x):

Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash - &&\
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:

use sudo on Ubuntu or run this as root on debian
apt-get install -y build-essential

Uninstall nodejs Ubuntu & Debian packages

To completely remove Node.js installed from the deb.nodesource.com package methods above:

use sudo on Ubuntu or run this as root on debian
apt-get purge nodejs &&\
rm -r /etc/apt/sources.list.d/nodesource.list


本文地址:https://liuchunjie.top/?id=503
版权声明:本文为原创文章,版权归 admin 所有,欢迎分享本文,转载请保留出处!

 发表评论


表情

还没有留言,还不快点抢沙发?