📂centos
🔖centos
2023-02-21 14:50阅读: 287评论: 0推荐: 0

centos安装node.js

本文的示例步骤中,使用的软件版本信息如下所述。当您使用不同软件版本时,需要根据实际情况自行调整命令和参数配置。最好安装前先备份快照
CentOS版本:7.6
Node.js 版本:16.4.2

安装Node.js 16

Node.js 包是通过 NodeSource Node.js Binary Distributions 和 .rpm 提供的。使用以下命令将存储库添加到系统:
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -

新版本已经取消了上面这个脚本安装了。

根据官网介绍使用下面指令安装。

sudo yum install https://rpm.nodesource.com/pub_16.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y
sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1

PS:安装生成工具

要从npm编译和安装本机插件,您可能还需要安装构建工具:

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

卸载nodejs Enterprise Linux软件包

要从上面的rpm.nodesource.com包方法中完全删除安装的Node.js,请执行以下操作:
使用sudo或以root用户身份运行

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

要安装 Yarn 包管理器

请运行以下命令:

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install -y yarn

安装完成后检查

node -v
npm -v
yarn --version

本文作者:安全兔

本文链接:https://www.cnblogs.com/safe-rabbit/p/17141011.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议许可协议进行许可。

posted @   安全兔  阅读(287)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 千与千寻(那个夏天) REOL
千与千寻(那个夏天) - REOL
00:00 / 00:00
An audio error has occurred.