Is there any way to configure multiple registries in a single npmrc file

前端 未结 11 819
孤独总比滥情好
孤独总比滥情好 2020-12-02 06:06

Here is my problem. We have a private NPM registry which only works in VPN. I would like to have a fallback registry https://registry.npmjs.org so that when I am out of VPN

11条回答
  •  温柔的废话
    2020-12-02 06:28

    Some steps you can try. (its how we do it at my workplace)

    • Create a registry group with two (or more) repository source address. One would be your internal private and the other a proxy to npmjs giving priority to the internal one.
    • Make this group your registry in the .npmrc file. This way npm will always try to get it from the internal one, if not found get it from the proxy

    Hope that helps.

提交回复
热议问题