在CentOS 8/7、RHEL 8/7系统上安装Node.js 14版本的方法

1.运行Node.js安装程序脚本

  下载并执行脚本:

1
2
3
$ sudo yum -y install curl
 
$ curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -

 2.在CentOS 8/7、RHEL 8/7系统上安装Node.js 14版本及以上版本

    RHEL 8上的安装与基于RHEL 7的Linux发行版上的安装相同,唯一的区别是,Node.js AppStream存储库已在RHEL/CentOS 8系统上被安装脚本禁用,如果您要安装AppStream版本的Node.js,则需要启用它:

1
sudo yum install -y nodejs

 3.验证是否安装成功

  验证node:

1
$ node -v

  返回信息:

  验证 npm

1
$ npm -v

 

 4.安装 Yarn 程序包管理器

1
2
// 下载包<br>$ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo<br>// 安装包
$ sudo yum install yarn

 5.如果需要为Node.js构建本机加载项,请考虑安装开发工具,运行如下命令:

1
$ sudo yum install gcc-c++ make
原文地址:https://www.cnblogs.com/heihei1990/p/14308828.html