centos7安装npm--Centos7安装Node.js环境 - nvm -v
1、使用 NodeSource 仓库
设置 NodeSource 仓库
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
上面的命令会安装 Node.js 16.x 版本。如果你想安装其他版本,可以替换 16.x 为其他版本号,例如 14.x 或 18.x。
安装 Node.js 和 npm
sudo yum install -y nodejs
2、使用 NVM(Node Version Manager) 拼多多帮助力入口
NVM 允许你管理多个 Node.js 版本。如果你需要管理多个版本或者想要更灵活地切换版本,NVM 是一个不错的选择。
安装 NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
或使用 wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
验证安装
nvm -v
安装node
nvm install 14.8.0
切换node
nvm use 14.8.0
3、验证安装
node -v
npm -v
如您在阅读中发现不足,欢迎留言!!!