安装指定版本nodejs,以18.X版本为例
1、通过curl命令向系统中添加NodeSource存储库
curl -sL https://deb.nodesource.com/setup_18.x | bash -
(如果提示 curl: command not found ,那是因为没装 Curl,
debian 系统安装 Curl 方法: apt-get update -y && apt-get install curl -y)
2、安装node
sudo apt install nodejs
3、检查是否安装成功
node -v
npm -v