Ubuntu环境下安装nodejs和npm

1.安装python-software-properties

sudo apt-get install python-software-properties

2.添加ppa

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

3.安装nodejs和npm

sudo apt-get install nodejs

4.查看版本

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

5.配置npm仓库

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/
posted @ 2018-04-21 22:49  TBHacker  阅读(2683)  评论(0编辑  收藏  举报