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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM