ubuntu npm 私有库搭建 (npmjs.org 官方版本)
异步 同步官方nodejs模块 (可以不做)
npm curl -X POST http://127.0.0.1:5984/_replicate -d '{"source":"http://registry.npmjs.org/registry/", "target":"registry", "continuous":true, "create_target":true}' -H "Content-Type: application/json"
2.修改配置
/usr/local/etc/couchdb/local.ini [couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true
[httpd]
bind_address = 0.0.0.0
secure_rewrites = false
[couchdb]
delayed_commits = false
[admins]
admin = password
3.上传npm程序
git clone git://github.com/npm/npm-registry-couchapp
cd npm-registry-couchapp
sudo npm install -g couchapp
npm install
npm start --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry
npm run load --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry
npm run copy --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry
couchapp push www/app.js http://admin:password@localhost:5984/registry
这边推上去的两个程序访问地址:
http://localhost:5984/_utils/registry/_design/app/_rewrite
然后只需将registry指向couchdb即可操作私有npm库:
npm --registry http://localhost:5984/registry/_design/app/_rewrite login
npm --registry http://localhost:5984/registry/_design/app/_rewrite publish my-repo
私有npm到这里就建好了,链接好长!
于是在/usr/local/etc/couchdb/default.ini文件中添加:
[vhosts]
127.0.0.1:5984=/registry/_design/app/_rewrite
127.0.0.2:5984=/registry/_design/ui/_rewrite
这回我们可以用http://127.0.0.1:5984来代替那串长长的链接了
接着就是将私有npm库没有的模块(返回404)通过npmjs.org找,于是写nginx配置如下:
server {
listen 80;
server_name npm.XXX.com;
location / {
proxy_set_header Host 127.0.0.1:5984;
proxy_pass http://127.0.0.1:5984;
proxy_intercept_errors on;
error_page 404 = @fallback;
} location @fallback{
internal;
proxy_set_header Host registry.npmjs.org;
proxy_pass http://registry.npmjs.org;
}
}
server {
listen 80;
server_name npmui.XXX.com;
location / {
proxy_set_header Host 127.0.0.2:5984;
proxy_pass http://127.0.0.2:5984;
}
}
registry=http://npm.XXX.com/
就可以使用我们的私有库了
npm login
#登录 admin password
#进入我们的私有包目录 完善package.json 然后
npm publish
#删除的话是
npm unpublish ***@0.0.0
ubuntu npm 私有库搭建 (npmjs.org 官方版本)的更多相关文章
- 使用npm私有服务器保存公司内部强业务类型组件(一):npm私有服务器搭建
1:安装centOS虚拟机 2:安装完成虚拟机后完成后开启系统网卡: 进入到/etc/sysconfig/network-scprits/ 打开ifcfg-ens33文件 找到 ONBOOT=NO 改 ...
- maven私有库搭建
一.在企业中基本上都会有自己的maven私有库,主要的目的就是方便依赖包的下载.如果采用远程的方式来实现的话,很多时候会考虑网速问题.如果自己活着公司搭建的私有库,这一样在使用上面会效率更高. 二.私 ...
- [k8s]helm原理&私有库搭建&monocularui和kubeapp探究
运行最简单的charts示例 helm的2个chart例子: https://github.com/kubernetes/helm/tree/master/docs/examples/nginx he ...
- docker私有库搭建过程(Registry)
实验环境: CentOS7 1611 Docker 1.12.6 registry 2.0 1.安装并运行registry 安装: [root@docker01 ~]# docker pull r ...
- 使用verdaccio+docker搭建npm私有仓库以及使用
公司内部前端组件或库的共享等,搭建一个npm私有库就很方便,现在中大型公司也基本都有自己的npm私有库,这篇文章,和大家一起共同搭建一个npm私有库,共同学习 前置条件 一台电脑 可以联网 一.安装d ...
- 使用 docker + verdaccio 搭建npm私有仓库
本文介绍如何使用 verdaccio 搭建私有npm仓库,以及使用 docker 时如何映射到本地目录,方便简单对仓库进行各种操作.系统环境是 Linux. verdaccio verdaccio 是 ...
- 远程私有库的创建 pod 组件化
参考: http://www.cnblogs.com/hs-funky/p/6780203.html http://www.jianshu.com/p/4b63dfbd8be7 http://ww ...
- 使用verdaccio 搭建npm私有仓库
使用verdaccio 搭建npm私有仓库 1. 为什么要搭建私有的npm仓库? 随着公司的业务越来越复杂,项目迭代速度也越来越快,那么项目间的常用的业务代码共享变得非常之有必要.但是对于公司的 ...
- ndoe.js 和npm私有仓库的搭建
下载nodejs的压缩包 网址:https://nodejs.org/en/ 下载以tar.xz结尾的包例如:node-v8.9.4-linux-x64.tar.xz 上传包到制定的目录 可以用lrz ...
随机推荐
- Linux如何查找文件安装路径?
Linux中查看某 个软件的安装路径(地址)有时显得非常重要.比如某个文件的快速启动项被删除,或者你要建立快速启动项,或者想删除. 添加安装文件等等,很多地方都要用到查案文件安装路径的命令. 这里给大 ...
- PAT 1076. Forwards on Weibo (30)
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may ...
- 一、两种方式初始化Mybatis
一.xml Configuration.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTY ...
- 准备在新项目中使用pgsql【资源收集】
pgsql大象数据库 是我最近在关注的一款开源数据库,可以自由修改,没那么多限制,准备在新项目中使用 postgresql中国下载站 http://www.postgres.cn/download#s ...
- Java整型与字符串相互转换(转)
1如何将字串 String 转换成整数 int? A. 有两个方法: 1). int i = Integer.parseInt([String]); 或 i = Integer.parseInt([S ...
- mysql查询随机几条数据(速度快)
MySql查询随机几条数据 想到了 Max RAND 这几个函数 用以下2种办法都可以实现查询. 速度还行. 几十万数据左右, 没有什么问题. SELECT * FROM `news` WHERE i ...
- POJ 1185 炮兵
是中国标题.大家都说水问题.但是,良好的1A它? 标题效果: 给出n*m的矩阵,当某个单元格有炮兵部队时它的上下左右两格(不包含斜着的方向)是这支部队的攻击范围.问在两支部队之间不可能相互攻击到的情况 ...
- android 64 sd卡读写的操作
package com.itheima.writesd; import java.io.File; import java.io.FileNotFoundException; import java. ...
- NVMe 图解
http://www.ssdfans.com/?p=1143#rd&sukey=3997c0719f151520989740bb972a716fdb2dbab623808d16acd5075b ...
- iOS在xib或storyboard里为控件添加圆角、外框和外框颜色
如果要在xib和storyboard里为控件添加圆角和外框宽度,只要这样做就可以: layer.borderWidth 设置外框宽度属性 layer.cornerRadius 设置圆角属性 只要为属性 ...