yum安装node

时间:2025-02-16 10:16:00

1.指定node版本
以下以10版本为例,若想安装其他版本号注意数字部分替换成你想安装的版本号即可。

curl --silent --location /setup_10.x | sudo bash -

2.安装node
sudo yum -y install nodejs

3.查看node版本

node -v

删除

yum remove nodejs npm -y

一、修改成淘宝镜像源

1. 命令

npm config set registry

2. 验证命令

npm config get registry

如果返回,说明镜像配置成功。

二、修改成华为云镜像源

1. 命令

npm config set registry /repository/npm/

2. 验证命令

npm config get registry

如果返回/repository/npm/,说明镜像配置成功。

三、通过使用淘宝cnpm安装

1. 安装cnpm

npm install -g cnpm --registry=

2. 使用cnpm

cnpm install xxx