npm内网源搭建 | 您所在的位置:网站首页 › 内网使用npm › npm内网源搭建 |
前段时间用npm在公司搭建了npm内网源,把搭建过程及踩的坑记录一下。 准备工作: 安装node及npm,node版本4.2.2+(切记,4以下的版本是不行的) 首先下载源代码: git clone git://github.com/cnpm/cnpmjs.org.git如果没装git,直接去https://github.com/cnpm/cnpmjs.org/ 下载zip吧。 安装依赖,可从淘宝npm源安装加快速度: npm install --registry=http://registry.npm.taobao.org更改config,在cnpmjs.org/config/index.js,下面列出需要更改及留意的项目: enablePrivate: true, // 设置为true scopes: [ '@xxx', '@tools', '@doc'] // 私有源支持的模块前缀,可以自由设置(cnpm的要求,避免与官方模块冲突) syncModel: 'exist', // 只同步已有模块,all可以开启全量同步,但资源增长太快需慎重 admins: { // 注意,添加用户时,请添加该处配置的用户,不然不能发布模块的 // name: email fengmk2: '[email protected]', admin: '[email protected] |
CopyRight 2018-2019 实验室设备网 版权所有 |