使用 cnpmjs.org 来搭建。
1. 安装
npm install -g --build-from-source cnpmjs.org cnpm sqlite3
2. 启动
admins:myname, othernamescopes:my-company-name, other-namedefault ports:7001-registry, 7002-web
eg:
nohup cnpmjs.org start --admins='huxy,zys,huy' --scopes='@yiru,@zys,@yiru' &
使用 pm2 启动:
pm2 start `which cnpmjs.org` -- start
停止 pm2 服务:
pm2 delete id
3. 设置注册地址
默认端口 7001
cnpm set registry http://localhost:7001
4. 添加用户
// cnpm adduser
cnpm login
5. 发布
cnpm publish
6. 查看已发布的包
open http://localhost:7002/@scope/name
7. 安装包
cnpm i @scope/name
8. 删除发布的包
cnpm unpublish @scope/name --force
9. 配置文件
配置文件位于 ~/.cnpmjs.org/config.json 中:
{
"admins": {
"huxy": "ah.yiru@gmail.com",
"zys": "szhaoyao@gmail.com",
"huy": "642144711@qq.com"
},
"scopes": [
"@huxy",
"@zys",
"@yiru"
],
"registryPort": 7001,
"webPort": 7002,
"bindingHost": "0.0.0.0",
"registryHost":"",
"enablePrivate":false,
}