Install nodejs and npm in Ubuntu environment

1. Install python-software-properties

sudo apt-get install python-software-properties

2. Add ppa

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

3. Install nodejs and npm

sudo apt-get install nodejs

4. View version

$ node -v
v8.11.1
$ npm -v
5.6.0

5. Configure npm repository

sudo npm install -g nrm
$ nrm ls

* npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
  taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
$ nrm use taobao
Registry has been set to: https://registry.npm.taobao.org/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324609111&siteId=291194637