Node NPM 环境使用

  • 镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

1.通过config命令

npm config set registry https://registry.npm.taobao.org 
npm info underscore (如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm --registry https://registry.npm.taobao.org info underscore 

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org

搜索镜像: https://npm.taobao.org

建立或使用镜像,参考: https://github.com/cnpm/cnpmjs.org

  • nrm 管理npm查看工具

nrm是npm registry的管理工具,用来查看或切换当前使用的registry

1、安装

npm install -g nrm

2、使用介绍

2.1、查看系统配置了哪些registry

安装好之后默认会有下面这些镜像,可以使用nrm ls来查看

$nrm ls

npm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ eu -----http://registry.npmjs.eu/ au ----- http://registry.npmjs.org.au/ sl -----http://npm.strongloop.com/ nj ----- https://registry.nodejitsu.com/

2.2、添加一个地址

$nrm add 名称 http://XXXXX

可以给每一个镜像地址取一个名称,便于下面的使用

2.3、使用

$nrm use 名称

3、常见命令

nrm help // show help

nrm list // show all registries

nrm use cnpm // switch to cnpm

nrm home // go to a registry home page

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容