📌  相关文章
📜  删除旧版本的节点并安装新的 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:27.443000             🧑  作者: Mango

代码示例1
First remove previous version
$ sudo apt remove nodejs
Installing Node.js with Apt Using a NodeSource PPA
cd ~
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh
Inspect the contents of the downloaded script with nano (or your preferred text editor):
nano nodesource_setup.sh
When you are satisfied that the script is safe to run, exit your editor, then run the script with sudo
sudo bash nodesource_setup.sh
The PPA will be added to your configuration and your local package cache will be updated automatically. You can now install the Node.js package in the same way you did in the previous section:

sudo apt install nodejs
Verify that you’ve installed the new version by running node with the -v version flag:
node -v