[Ubuntu] Ubuntu 16 에 nodejs 및 npm 설치

1706 단어 linux
전송:
https://www.jianshu.com/p/2b24cd430a7d
단계:
ubuntu 소프트웨어 원본 업데이트
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common 
sudo add-apt-repository ppa:chris-lea/node.js 
sudo apt-get update

nodejs 설치
sudo apt-get install nodejs
sudo apt install nodejs-legacy
sudo apt install npm

npm 패키지 미 러 원본 업데이트, 빠 른 다운로드 편리
sudo npm config set registry https://registry.npm.taobao.org
sudo npm config list

전역 에 n 관리자 설치 (nodejs 버 전 관리 에 사용)
sudo npm install n -g

최신 nodejs 설치 (stable 버 전)
sudo n stable
sudo node -v

QA
Q: apt - get update 에서 파일 을 찾 을 수 없습니다.
// error code 
W: 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 Found 
E: Some index files failed to download. They have been ignored, or old ones used instead. 

// A:   node    :sudo gedit /etc/apt/sources.list.d/chris-lea-ubuntu-node_js-xenial.list 

deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main 
deb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main

약서
작성 자: 10 반지 s 링크:https://www.jianshu.com/p/2b24cd430a7d 출처: 간 서 간 서 저작권 은 작가 의 소유 이 며, 어떠한 형식의 전재 도 작가 에 게 연락 하여 권한 을 수 여 받 고 출처 를 밝 혀 주 십시오.

좋은 웹페이지 즐겨찾기