ubuntu 18.04安装nodejs
-
一,安装ubuntu 18.04 默认版本nodejs 8.10.0
sudo apt update
sudo apt install nodejs
sudo apt install npm
nodejs -v二,安装最新版本
curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejsThe nodejs package contains the nodejs binary as well as npm, so you don’t need to install npm separately.
In order for some npm packages to worksudo apt install build-essential三,删除nodejs
sudo apt remove nodejs
sudo apt purge nodejs //彻底删除 包括配置文件
sudo apt autoremove //清除依赖1.参考
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04