Add a custom registry for a non-scoped package with Yarn 3

49 Views Asked by At

I'm trying to use Yarn 3 in my project, but am having an issue with one package that is not scoped and is served from a private Artifactory registry. For the non-scoped package I get

➤ YN0035: │   non-scoped-component-lib@npm:^1.0.21: The remote server failed to provide the requested resource
➤ YN0035: │   Response Code: 404 (Not Found)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://private.artifactory.com/artifactory/api/npm/npmjs/non-scoped-component-lib

My .npmrc looks like this:

registry=https://private.artifactory.com/artifactory/api/npm/npmjs/
@non-scoped-component-lib:registry=https://private.artifactory.com/artifactory/api/npm/npm-non-scoped-component-lib-release/
//https://private.artifactory.com/artifactory/api/npm/npm-non-scoped-component-lib-release/:email=${NPM_EMAIL}
//https://private.artifactory.com/artifactory/api/npm/npm-non-scoped-component-lib-release/:_auth=${NPM_AUTH}
//https://private.artifactory.com/artifactory/api/npm/npm-non-scoped-component-lib-release/:always-auth=true
@scoped-lib:registry=https://private.artifactory.com/artifactory/api/npm/npm-scoped-lib-release/

My .yarnrc.yml looks like this:

npmRegistryServer: https://private.artifactory.com/artifactory/api/npm/npmjs/
npmAlwaysAuth: true
npmAuthToken: ${YARN_TOKEN:-}

npmScopes:
  scoped-lib:
    npmRegistryServer: https://private.artifactory.com/artifactory/api/npm/npm-non-scoped-component-lib-release/
    npmAlwaysAuth: true
    npmAuthToken: ${YARN_TOKEN:-}
  non-scoped-lib:
    npmRegistryServer: https://private.artifactory.com/artifactory/api/npm/npm-react-release/
    npmAlwaysAuth: true
    npmAuthToken: ${YARN_TOKEN:-}

I can't find any documentation that mentions how to do this. Any thoughts? Thanks for your time.

0

There are 0 best solutions below