步骤
本文中使用的Ubuntu版本号为
18.04
查看系统版本
1  | lsb_release -c  | 
Codename: bionic
备份原配置
1  | sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  | 
修改配置
1  | sudo rm -rf /etc/apt/sources.list  | 
修改为
1  | deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse  | 
更新软件列表
1  | sudo apt-get update  | 
更新Ubuntu软件源
1  | curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -  | 
安装nodejs
1  | sudo apt install -y nodejs &&\  | 
查看版本
1  | sudo node -v  | 
更新npm的包镜像源,方便快速下载
1  | sudo npm config set registry https://registry.npm.taobao.org  |