@i510:~$ curl -sL https://deb.nodesource.com/setup_9.x | sudo bash -
[sudo] 的密码:
## Installing the NodeSource Node.js 9.x repo...
## Populating apt-get cache...
+ apt-get update
命中:1 https://download.docker.com/linux/debian stretch InRelease
忽略:2 http://mirrors.163.com/debian stretch InRelease
忽略:3 http://dl.google.com/linux/chrome/deb stable InRelease
获取:4 http://mirrors.163.com/debian stretch-updates InRelease [91.0 kB]
.........................................................................
命中:12 http://mirrors.163.com/debian stretch Release
已下载 5,388 B,耗时 42秒 (127 B/s)
正在读取软件包列表... 完成
## Run `sudo apt-get install -y nodejs` to install Node.js 9.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
@i510:~$ sudo apt-get install nodejs
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
nodejs
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 12.8 MB 的归档。
解压缩后会消耗 62.5 MB 的额外空间。
获取:1 https://deb.nodesource.com/node_9.x stretch/main amd64 nodejs amd64 9.11.2-1nodesource1 [12.8 MB]
已下载 12.8 MB,耗时 13秒 (986 kB/s)
正在选中未选择的软件包 nodejs。
(正在读取数据库 ... 系统当前共安装有 150187 个文件和目录。)
正准备解包 .../nodejs_9.11.2-1nodesource1_amd64.deb ...
正在解包 nodejs (9.11.2-1nodesource1) ...
正在设置 nodejs (9.11.2-1nodesource1) ...
正在处理用于 man-db (2.7.6.1-2) 的触发器 ...
@i510:~$ node -v
v9.11.2
@i510:~$ npm -v
5.6.0
@i510:~$ sudo npm install nrm -g
npm WARN notice [SECURITY] open has the following vulnerability: 1 critical. Go here for more details: https://www.npmjs.com/advisories?search=open&version=0.0.5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN deprecated coffee-script@1.7.1: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
/usr/bin/nrm -> /usr/lib/node_modules/nrm/cli.js
+ nrm@1.2.0
added 493 packages in 39.31s
@i510:~$ nrm ls
* npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npm.taobao.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
@i510:~$ nrm use taobao
Registry has been set to: https://registry.npm.taobao.org/
@i510:~$ nrm test npm
npm ---- 1209ms
@i510:~$