[英]How to migrate private Verdaccio npm registry to another server?
[英]How to create offline private registry of verdaccio
我使用verdaccio
創建了私有npm registry
。
我希望能夠運行npm install --registry="http://localhost:4873"
並從 private registry
獲取所有依賴registry
。
我需要從我的項目node_modules
目錄中發布所有包。
我不得不在node_module
目錄中的每個包中運行npm publish
。(我找不到更好的方法。)
更多的成功發布但在某些情況下,我遇到了錯誤。 例如在zone.js
包中:
npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! zone.js@0.8.29
prepublish: `tsc && gulp build` npm ERR! Exit status 2 npm ERR! npm
ERR! Failed at the zone.js@0.8.29 prepublish script. npm ERR! This is
probably not a problem with npm. There is likely additional logging
output above. npm WARN Local package.json exists, but node_modules
missing, did you mean to install?
或acorn
包裝:
acorn@5.7.3 build:main C:\Users\Admin\Desktop\test ng\ng-prj\node_modules\acorn
rollup -c rollup/config.main.js
'rollup' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! acorn@5.7.3 build:main: `rollup -c rollup/config.main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the acorn@5.7.3 build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
有沒有一種簡單的方法可以做到這一點?
這里 Verdaccio 維護者。
我希望能夠運行 npm install --registry="http://localhost:4873" 並從私有注冊表中獲取所有依賴項。
您想要的是擁有一個包含所有依賴項的離線注冊表。 發布所有node_modules
是不切實際的,幾乎是不可能的。
更多的成功發布但在某些情況下,我遇到了錯誤。 例如在 zone.js
這就是重點,您需要構建每個依賴項,這沒有意義。 一個普通的項目很容易有成千上萬的依賴和子依賴。 更不用說你會失去未來依賴更新的優勢。
因此,您需要的是正確緩存存儲文件夾中的所有依賴項。
$> verdaccio
npm install --registry="http://localhost:4873
proxy
如下packages:
'@*/*':
access: $all
publish: $authenticated
# proxy: npmjs
'**':
access: $all
publish: $authenticated
# proxy: npmjs
如果您注釋掉
proxy
Verdaccio 不會要求對遙控器進行任何更新,默認情況下是npmjs
,因此不會執行與外部網絡的連接。
所以,在這里,這種方法的優點。
lodash: ^1.5.6
)node_modules
並清理npm cache
。node_modules
發布每個包,因此請參見第 2 點)。我希望這可以幫助你。 此外,還有其他與離線模式相關的實踐,但僅限於yarn 。
我們使用了上面胡安皮卡多的建議。 這是我們所做的:
此時,運行 npm install 命令只會指向您的 verdaccio 實例,而不會轉到 registry.npmjs.com 並且 /home/verdaccio/storage 中的包將是您的離線可用包。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.