npm 配置源, 安装 live-server

2019-03-29  本文已影响0人  battleMonkey

写在前面: npm 配置

作者:请叫我足下
链接:https://www.jianshu.com/p/a2dc9400ff56

sudo apt install npm
  1. 查看npm源地址
$ sudo npm config ls -l | grep registry

结果:

registry = "https://registry.npmjs.org/"
  1. 使用淘宝的npm源全局安装nrm包;
$ sudo npm i nrm -g --registry=https://registry.npm.taobao.org/

使用nrm ls查看当前所有可用的镜像源地址以及当前所使用的镜像源地址,*号标记的就是当前使用的npm源;

$ 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 npmnrm use taobao切换不同的镜像源地址,例如你想切换npm源到npm官方源;

$ nrm use npm
   Registry has been set to: https://registry.npmjs.org/
$ 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/
# 更新 npm 版本可执行如下命令
$ sudo npm i npm -g

安装 live-server警告 -> 暂时 没发现有什么影响

image.png
上一篇 下一篇

猜你喜欢

热点阅读