Ubuntu Installation Nodejs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.