CentOS 安装Node包管理工具nvm – MasterH杂货铺

CentOS 安装Node包管理工具nvm

安装版本管理工具

安装git

yum install git -y

file

查看版本

git --version

file

安装nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

git clone git://github.com/creationix/nvm.git ~/nvm

根目录下创建nvm文件夹和nvm.sh文件

mkdir /root/nvm
touch /root/nvm/nvm.sh

file

设置nvm自动运行

echo "source ~/nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc

查看Node.js所有版本

nvm list-remote

file

安装指定Node.js版本

这里我们安装16和18的版本

nvm install 16.20.2
nvm install 18.18.0

file
file

列出已安装的Node.js版本

nvm list

file
目前et默认使用16的版本

Related Posts

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注