200字
linux下安装nodejs(npm)
2026-04-05
2026-04-05

1.下载脚本并执行

curl -fsSL https://rpm.nodesource.com/setup_24.x | sudo bash -
yum install -y nodejs

2.检查版本

node -v  # 查看 Node.js 版本
npm -v   # 查看 npm 版本

3.升级版本

升级到最新版本(当前大版本的最高版本)

npm install -g npm@latest
或
npm update -g npm

升级到特定版本

npm install -g npm@11.9.0

4.指定淘宝镜像

npm config set registry https://registry.npmmirror.com

查看当前镜像

npm config get registry
# 或
npm config list

评论