Use npm to install n globally (since you need to write files, you use sudo to elevate the operation and use administrator privileges to execute the command) sudo npm i -g n
After the progress bar runs out, check whether the installation is complete. n -V
Install and switch node versions
List all node versions n ls
install a version sudo n xx.xx.x (xx.xx.x 为要安装的版本号)
Install the latest versionsudo n lastest
Install the latest stable versionsudo n stable
Switch the node version (enter the command and select the up and down keyboard to confirm) n