一、TEarth环境准备与项目引入
2018-12-21 本文已影响0人
码农007
1.node环境
2.仓库管理工具 nrm
nrm 是一个 npm 源管理器,允许你快速地在 npm 源间切换
在命令行执行命令,npm install -g nrm,全局安装nrm
3.添加上公司的仓库

nrm add registry http://registry.npm.frp.trmap.cn/
4. 安装TEarth的项目
npm install t-earth --save
5.在项目中引用
import TEarth from 't-earth'
修改仓库
原来的 http://registry.npm.frp.trmap.cn/ 停止
http://mirror.frp.trmap.cn
6也可以直接输入以下命令查看当前使用的是哪个源
nrm current
7切到源http://r.cnpmjs.org/,命令:nrm use 源的别名,即
nrm use cnpm
8执行成功提示
Registry has been set to: http://r.cnpmjs.org/
9用nrm add 命令添加公司私有npm源,如http://mirror.frp.trmap.cn(私服),起个别名叫trnpm
nrm add trnpm http://mirror.frp.trmap.cn
10接着查看nrm配置,发现最底部trnpm添加成功
11 添加完了可以顺便测试下速度(只能测试已添加的源的别名,直接测试源URL是没有前途的),因为我随便写的地址,就测试一下官方的好了
nrm test npm
输出:
npm ---- 1547ms
是挺慢的。
12最后,如果你被公司开除了,怒删公司npm源配置
nrm del trnpm