How to specify local registry in yarn?

后端 未结 4 1997
暖寄归人
暖寄归人 2021-02-02 13:05

I have a local nexus server, I\'d like yarn to look through it before going online, basically prefer-offline

yarn install --prefer-offline --cache-fol

4条回答
  •  無奈伤痛
    2021-02-02 13:25

    • Create an npm (hosted) repository to use as your private registry. I believe you have already done this.
    • Create an npm (proxy) repository pointing to your external repository of choice (https://registry.yarnpkg.com or https://registry.npmjs.org/).
    • Create an npm (group) with your private registry on first position and the proxy registry on second position.
    • Point yarn to your group repository: yarn config set registry http://nexus.local/repository/npm-group/. If required by your Nexus configuration, authenticate yarn: yarn login.

    Also be wary of yarn using any npm config you might have over it's own: https://github.com/yarnpkg/yarn/issues/4862

提交回复
热议问题