Search code examples
yarnpkg-v2

Yarn 3 - How to point installer to correct registry


In my current project which uses NPM Enterprise (i.e. has an internal npm registry), I'm following the steps to migrate from Yarn Classic to Modern. Step 7 says to run yarn install. In doing so, the install fails because it's looking for a library in the public registry:

➤ YN0035: │ AppolloReact@npm:^2.3.21: The remote server failed to provide the requested resource
➤ YN0035: │   Response Code: 404 (Not Found)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://registry.yarnpkg.com/AppolloReact

The Request URL should list our internal registry https://npme.<name>.com. I checked that npm has the correct registry by running

yarn config get registry

As an aside, YN0035 error code is not listed in the Error Codes section, although I guess it means http error.

Anyone have experience with redirecting the installer to point to an internal registry?


Solution

  • For yarn modern, I learned the config param was renamed to npmRegistryServer. So to set/get, the command would be yarn config set|get npmRegistryServer <url>