npm配置镜像、设置代理
配置镜像
by config command
npm config set registry http://registry.cnpmjs.org
npm info underscore (如果上面配置正确这个命令会有字符串response)命令行指定
npm --registry http://registry.cnpmjs.org info underscore
编辑 ~/.npmrc 加入下面内容
registry = http://registry.cnpmjs.org
设置代理
npm config set proxy http://server:port
npm config set https-proxy http://server:port
如果需要认证的话可以这样设置:
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
如果代理不支持https的话需要修改npm存放package的网站地址。
npm config set registry "http://registry.npmjs.org/"
使用nrm快速切换npm源
nrm 是一个 NPM 源管理器,允许你快速地在如下 NPM 源间切换:
- 列表项目
- npm
- cnpm
- strongloop
- enropean
- australia
- nodejitsu
- taobao
Install
sudo npm install -g nrm
如何使用?
列出可用的源:
➜ ~ nrm ls
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
taobao - http://registry.npm.taobao.org/
eu ----- http://registry.npmjs.eu/
au ----- http://registry.npmjs.org.au/
sl ----- http://npm.strongloop.com/
nj ----- https://registry.nodejitsu.com/
pt ----- http://registry.npmjs.pt/
切换:
➜ ~ nrm use taobao
Registry has been set to: http://registry.npm.taobao.org/
增加源:
nrm add <registry> <url> [home]
删除源:
nrm del <registry>
测试速度:
nrm test
npm配置镜像、设置代理的更多相关文章
- npm 淘宝设置代理
直接安装cnpm导致无限索引,因此直接使用代理 方法一: 直接在当前用户文件夹下,npmrc 文件上直接设置代理:registry=https://registry.npm.taobao.org 方法 ...
- npm配置镜像及nrm使用
淘宝npm镜像 搜索地址:http://npm.taobao.org/ registry地址:http://registry.npm.taobao.org/ cnpmjs镜像 搜索地址:http: ...
- npm国内镜像设置
http://cnodejs.org/topic/4f9904f9407edba21468f31e
- 设置 git/npm/bower/pip/gem镜像或代理
git 设置: $ git config --global http.proxy http://proxy.mysite.com 取消: $ git config --global --unset h ...
- npm获取配置,设置代理
npm获取配置有6种方式,优先级由高到底. 命令行参数. --proxy http://server:port即将proxy的值设为http://server:port. 环境变量. 以npm_con ...
- npm安装express 公司上网设置代理
异常: 0 info it worked if it ends with ok1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe' ...
- npm配置代理
有时候可能因为使用代理,使用npm下载node模块会报"proxy"相关的错误,error提示ECONNECT,好像是这么拼的. 解决办法 1 配置代理 npm config se ...
- (二)初探Maven之设置代理和阿里云镜像
引言: 在许多公司,可能因为安全性的要求配置了代理服务器,用户无法直接访问外网,所以在项目中使用Maven必须设置好代理才能下载依赖. 并且直接从中央仓库下载依 ...
- 使用npm安装webpack失败时,可能被墙要为cmd命令行设置代理
一.搜索到的相关概念: Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. npm是 Node packaged Modules(node的包管理工具).本身用n ...
随机推荐
- SQL Server DATEDIFF() 函数(SQL计算时间差)
select * from task_list where 1=1 and datediff(dd,carateTime,getdate()) =0 定义和用法 DATED ...
- LINUX 内核守护进程
http://alfred-sun.github.io/blog/2015/06/18/daemon-implementation/
- BoundingBoxUV与BoundingBoxXYZ
start UIApplication app = commandData.Application; Document doc = app.ActiveUIDocument.Document; ); ...
- delphi TOnFormVisibleChangeEvent 事件应用
TGQIFileMgrForm = class(TForm) 定义 property OnVisibleChange: TOnFormVisibleChangeEvent read FOnVisibl ...
- cefsharp wpf 中文输入问题解决方法
摘要 最近在搞一个客户端的项目,考虑使用wpf,内嵌webView的方式,访问h5页面.所以使用了CefSharp组件,但发现一个问题,就是在输入中文的时候,无法输入. 解决办法 去官方github的 ...
- Android的学习之路(三)项目的启动过程和安装过程具体解释
应用的安装和启动过程: 安装:第一步:java的编译器会把这个.java文件编译成.class文件 第二部:Android的SDK提供了一个dx工具,这个工具把.class文件转义 ...
- 在ASP.NET MVC中实现本地化和全球化
在开发多语言网站时,我们可以为某种语言创建一个资源文件,根据浏览器所设置的不同语言偏好,让运行时选择具体使用哪个资源文件.资源文件在生成程序集的时候被嵌入到程序集. 本篇体验,在ASP.NET MVC ...
- 在ASP.NET MVC中使用Knockout实践07,自定义验证信息的位置与内容
在前两篇中,体验了Knockout的基本验证和自定义验证.本篇自定义验证信息的显示位置与内容. 自定义验证信息的显示位置 通常,Knockout的验证信息紧跟在input后面,通过validation ...
- springboot—spring aop 实现系统操作日志记录存储到数据库
原文:https://www.jianshu.com/p/d0bbdf1974bd 采用方案: 使用spring 的 aop 技术切到自定义注解上,针对不同注解标志进行参数解析,记录日志 缺点是要针对 ...
- 【gitlab】首次提交本次代码到gitlab上,报错:Updates were rejected because the remote contains work that you do
首次提交本次代码到gitlab上,报错:Updates were rejected because the remote contains work that you do 报错情况如下: 错误原因: ...