Update Ubuntu Software source
sudo apt-get updatesudo apt-get install -y python-software-properties software-properties-commonsudo add-apt-repository ppa:chris-lea/node.jssudo apt-get update
Installing Nodejs
sudo apt-get install nodejssudo apt install nodejs-legacysudo apt install npm
Update NPM's package image source for quick and easy download
sudo npm config set registry https://registry.npm.taobao.orgsudo npm config list
Global Installation N Manager (for managing NODEJS versions)
sudo npm install n -g
Install the latest Nodejs (stable version)
sudo n stablesudo node -v
Qaq:apt-get update could not find the file
// error codeW: The repository ‘http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial Release‘ does not have a Release file.N: Data from such a repository can‘t be authenticated and is therefore potentially dangerous to use.N: See apt-secure(8) manpage for repository creation and user configuration details.E: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not FoundE: Some index files failed to download. They have been ignored, or old ones used instead.// A: 修改node相关文件:/etc/apt/sources.list.d/chris-lea-ubuntu-node_js-xenial.listdeb http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty maindeb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main
Q:node-v exception
node -v-bash: /usr/local/bin/node: Permission deniedsudo node -vSegmentation fault (core dumped)// A: 重新安装nodejs手动移除 /usr/local/lib/node_modules整个目录手动移除 /usr/local/bin/node手动移除 /usr/local/bin/n手动移除 /usr/local/bin/npm
Ubuntu Software Source
Modify the/etc/apt/sources.list to the following software source (back up before you change)
163 and inside under some network will continue to download the failure, you can change back to the official source download
SOURCE list
http://wiki.ubuntu.org.cn/Template: 16.04source
Ubuntu official
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiversedeb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiversedeb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiversedeb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiversedeb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiversedeb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiversedeb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
Ubuntu Installation Nodejs