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 ...
随机推荐
- Twitter 工程师谈 JVM 调优
一. 调优需要关注的几个方面 内存调优 CPU 使用调优 锁竞争调优 I/O 调优 二. Twitter 最大的敌人:延迟 导致延迟的几个原因? 最大影响因素是 GC 其他的有:锁和线程调度.I/O. ...
- 机器学习笔记1——Introduction
Introduction What is Machine Learning? Two definitions of Machine Learning are offered. Arthur Samue ...
- HTML5 API 浏览器支持情况检测
HTML5发展到现在,虽说没有大规模的普及,但在我们日常生活中,也很容易见到了,HTML5的游戏.网站.应用也是层出不穷.而作为前端人员,也应该多了解这些API为以后应用打基础,下面我将给大家介绍 H ...
- C# 自己对delegate的总结和认识
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 用高德地图API 通过详细地址获得经纬度
http://cloud.sinyway.com/Service/amap.html http://restapi.amap.com/v3/geocode/geo?key=xxxxxxxxxxxxxx ...
- 80端口被system占用的问题
80端口被system占用的问题今天启动Apache的时候发现无法启动-80端口被占用. 检查进程发现是system进程id=4给占用了.这个是系统进程 检查服务,看看IIS.没发现问题. 检查了半天 ...
- Android开发_SharedPreferences
SharedPreferences是Android平台上一个轻量级的存储类,主要是保存一些常用的配置比如窗口状态,一般在Activity中 重载窗口状态onSaveInstanceState保存一般使 ...
- hadoop错误org.apache.hadoop.mapred.TaskAttemptListenerImpl Progress of TaskAttempt
错误: org.apache.hadoop.mapred.TaskAttemptListenerImpl: Progress of TaskAttempt 原因: 错误很明显,磁盘空间不足,但郁闷的是 ...
- Android界面的View以及ViewGroup的区别
因为这个问题会经常成为面试的热点,所以我们来谈谈View以及ViewGroup的区别. 先看看View及ViewGroup类关系 Android View和ViewGroup从组成架构上看,似乎 ...
- Python获取web页面信息
import sys, urllib2 # req = urllib2.Request(sys.argv[1]) req = urllib2.Request('http://www.sina.com. ...