verdaccio/verdaccio這個很好搭建含末,再加上docker更是方便贬堵。
- .npmrc配置項的使用
安裝 node-sass 的時候總是會各種不成功
lmk123/blog 安裝 node-sass 的正確姿勢
registry=http://localhost:4873/
注冊本地倉庫屈扎,拉代碼的話會首先去這里查找此蜈,找不到就回去https://www.npmjs.com/查找
npm publish代碼的話也會將代碼發(fā)布到.npmrc配置的私有倉庫
verdaccio官網(wǎng)推薦的命令行方式: npm publish --registry http://localhost:4873
配置.npmrc的話就省去了后面參數(shù)的書寫
之前在docker上安裝了verdaccio抠璃,并發(fā)布了一個項目到上面可是重啟后塔沃,數(shù)據(jù)丟失腰奋,就是沒有保存到磁盤上单起,今天安裝到了我的windows上面,通過localhost:4873,但是我的mac沒法訪問劣坊,即使通過windows電腦的http://192.168.0.107:4873也沒法訪問嘀倒,查閱了verdaccio/conf/full.yaml發(fā)現(xiàn)這么是可以配置的
# You can specify listen address (or simply a port).
# If you add multiple values, verdaccio will listen on all of them.
#
# Examples:
#
#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
然后在我的C:\Users\Assassin\AppData\Roaming\verdaccio\config.yaml
文件里增加兩行配置,重啟verdaccio讼稚,在mac上順利的訪問了windows的verdaccio倉庫
storage: ./storage
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmjs:
url: 'https://registry.npmjs.org/'
packages:
'@*/*':
access: $all
publish: $authenticated
proxy: npmjs
'**':
access: $all
publish: $authenticated
proxy: npmjs
logs:
- type: stdout
format: pretty
level: http
listen://新增
- localhost:4873
- http://192.168.0.107:4873
上面的storage標(biāo)明了我publish文件存儲的位置括儒,每個版本清晰可見
Host, Publish and Manage Private npm Packages with Verdaccio