npm 私服工具verdaccio 安装配置试用

 
1. 安装
npm install -g verdaccio
2. 启动
verdaccio

// 界面显示信息
Verdaccio doesn't need superuser privileges. Don't run it und
 warn --- config file  - /root/.config/verdaccio/config.yaml
 warn --- http address - http://localhost:4873/ - verdaccio/
3. 配置
a. 监听端口
//  默认只能本地访问,远程访问配置
/root/.config/verdaccio/config.yaml
listen:
# - localhost:4873            # default value
# - http://localhost:4873     # same thing
  - 0.0.0.0:4873              # listen on all addresses (INADDR_ANY)
# - https://example.org:4873  # if you want to use https
# - [::1]:4873                # ipv6
# - unix:/tmp/verdaccio.sock    # unix socket
b. 用户账户管理
// 默认使用htpasswd 进行管理的,网上也有ldap 的插件
npm adduser --registry http://localhost:4873
类似如下:
Username: rong
Password: 
Email: (this IS public) demo@qq.com
Logged in as rong on http://localhost:4873/.
4. 登录界面
 
 
5. 创建私有包
npm init -f 

touch index.js

var user ={
 name:"dalong",
 age:33
}
module.exports=user;

npm adduser --registry http://xxxxxx:4873

npm publish --registry http://xxxx:4873

// ok  具体的操作就是这样
6.  效果效果
 
 
 
 
数据存储目录
 
7. 总结
总的来说使用起来还是比较简单的,同时官方也提供了docker 的 image 对于开发,持续集成还是比较简单的,

备注:对于服务启动,建议别用root 不然会有一些特殊的问题,大家应该懂得,同时启动的时候也有提示,说白了
大家只要准守规范,什么事情都会比较简单了。类似的工具比较多,目前集成全家桶的nexus(maven bower docker npm ...) 
也是挺不错的工具,可以方便开发
8. 参考文档
https://github.com/verdaccio/verdaccio

posted on 2017-11-09 22:40  荣锋亮  阅读(4684)  评论(0编辑  收藏  举报

导航