Yarn: Cannot find packages in private npm registry

Created on 11 Oct 2016  Β·  18Comments  Β·  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
_bug_
What is the current behavior?
Does not find package found only in private npm registry
If the current behavior is a bug, please provide the steps to reproduce.
Include a dependency in private repo that does not exist on the npm registry
What is the expected behavior?
It should fall back to the private npm registry when it cannot find the packages in
Please mention your node.js, yarn and operating system version.

$ node -v
v6.5.0
$ npm -v
3.10.3
$ yarn --version
0.15.1
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[1/4] Resolving packages...
error Couldn't find package "private-package-from-artifactory" on the "npm" registry.
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

I expected it to then look at my npm registry setting (see below) and look for the package from my private repo. I have tried changing my yarn registry to match my npm registry, but that doesn't help. If it cannot find a package from yarn, it should look in the private registry.

$ yarn config list
yarn config v0.15.1
info yarn config
{ registry: 'https://registry.yarnpkg.com',
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'ignore-scripts': false,
  'ignore-optional': true,
  'user-agent': 'yarn/0.15.1 npm/? node/v6.5.0 linux x64' }
info npm config
{ registry: '<artifactory-host>/artifactory/api/npm/npm-virtual',
  prefix: '~/npm',
  _auth: '...',
  'always-auth': true,
  email: '...' }
Done in 0.05s.
cat-compatibility

Most helpful comment

Issue #521 talks about private repos hosted by npm, but for my setup I have my own private server hosting my own private package. I am not sure if that changes things.

All 18 comments

I am also having the same issue. Yarn doesn't seem to see the registry defined in my .npmrc file

For my config:

==> yarn config list
yarn config v0.15.1
info yarn config
{ email: '[email protected]',
  username: 'ondrejbartas',
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'ignore-scripts': false,
  'ignore-optional': true,
  registry: 'https://registry.yarnpkg.com',
  'user-agent': 'yarn/0.15.1 npm/? node/v4.2.4 darwin x64' }
info npm config
{ 'registry': 'http://registry.npmjs.org/:_authToken=XXXXXXXXXX' }

I am getting:

error https://registry.yarnpkg.com/@blueberry%2fmy-private-package: Not found

which is strange.

There's an open work issue on this currently - https://github.com/yarnpkg/yarn/issues/521

Issue #521 talks about private repos hosted by npm, but for my setup I have my own private server hosting my own private package. I am not sure if that changes things.

My case is where we use Gemfury as a private registry. It just needs to support the registry configuration option.

Yes, if the registry configuration would be supported, it should work for custom/private npm registries like Gemfury or Nexus from Sonatype.

I think this is a different feature than #521 which is about private modules in the official npm registry and not about private/custom registries.

I also have the same problem and I'm using artifactory. In another issue someone suggested to put registry info in the .yarnrc file and it seems to work for them

in .yarnrc

registry "<artifactory-host>/artifactory/api/npm/npm-virtual"

However, when I do this I cannot find the other packages now.

I get this error

yarn install v0.15.1
info No lockfile found.
[1/4] πŸ”  Resolving packages...
error Couldn't find package "angular" on the "npm" registry.
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

Same setup works perfectly fine with npm

I am also experiencing this, yarn cannot find packages - we're using a Nexus npm registry which also mirrors and caches npm's registry.

I am getting errors like:

Zens-MacBook-Air src/main β€Ήdevelop*β€Ί Β» yarn
yarn install v0.15.1
info No lockfile found.
warning [email protected]: No license field
[1/4] πŸ”  Resolving packages...
error Couldn't find package "animate.css" on the "npm" registry.
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

also if this helps:

Zens-MacBook-Air src/main β€Ήdevelop*β€Ί Β» yarn config list                                                     1 ↡ β”‚
yarn config v0.15.1                                                                                             β”‚
info yarn config                                                                                                β”‚
{ registry: 'https://<somewhere>/nexus/content/groups/haze-npm-all/',                                 β”‚
  auth: '<somewhere>',                                                             β”‚
  'version-tag-prefix': 'v',                                                                                    β”‚
  'version-git-tag': true,                                                                                      β”‚
  'version-git-sign': false,                                                                                    β”‚
  'version-git-message': 'v%s',                                                                                 β”‚
  'init-version': '1.0.0',                                                                                      β”‚
  'init-license': 'MIT',                                                                                        β”‚
  'save-prefix': '^',                                                                                           β”‚
  'ignore-scripts': false,                                                                                      β”‚
  'ignore-optional': true,                                                                                      β”‚
  'user-agent': 'yarn/0.15.1 npm/? node/v5.6.0 darwin x64' }                                                    β”‚
info npm config                                                                                                 β”‚
{ registry: 'https://<somewhere>/nexus/content/groups/haze-npm-all/',                                 β”‚
  'init.author.name': 'Zen Savona',                                                                             β”‚
  'init.author.email': '[email protected]',                                                                         β”‚
  'init.author.url': 'http://spruce.ki',                                                                        β”‚
  email: '[email protected]',                                                                                       β”‚
  _auth: '<somewhere>',                                                            β”‚
  'always-auth': true }                                                                                         β”‚
✨  Done in 0.05s.

@Zensavona I've found that adding double slash at the end of your registry url fixes this issue.

I've filed this as a bug in detail here #775

Thanks @serkanyersen I actually just saw your other ticket and tried that, I changed both my .yarnrc and .npmrc

Zens-MacBook-Air src/main β€Ήdevelop*β€Ί Β» yarn config list                                                     1 ↡ β”‚
yarn config v0.15.1                                                                                             β”‚
info yarn config                                                                                                β”‚
{ registry: 'https://<somewhere>/nexus/content/groups/haze-npm-all//',                                β”‚
  auth: '<secret>',                                                             β”‚
  'always-auth': true,                                                                                          β”‚
  'version-tag-prefix': 'v',                                                                                    β”‚
  'version-git-tag': true,                                                                                      β”‚
  'version-git-sign': false,                                                                                    β”‚
  'version-git-message': 'v%s',                                                                                 β”‚
  'init-version': '1.0.0',                                                                                      β”‚
  'init-license': 'MIT',                                                                                        β”‚
  'save-prefix': '^',                                                                                           β”‚
  'ignore-scripts': false,                                                                                      β”‚
  'ignore-optional': true,                                                                                      β”‚
  'user-agent': 'yarn/0.15.1 npm/? node/v5.6.0 darwin x64' }                                                    β”‚
info npm config                                                                                                 β”‚
{ registry: 'https://<somewhere>/nexus/content/groups/haze-npm-all//',                                β”‚
  'init.author.name': 'Zen Savona',                                                                             β”‚
  'init.author.email': '<someone>@<somewhere>',                                                                         β”‚
  'init.author.url': 'http://spruce.ki',                                                                        β”‚
  email: '<someone>@<somewhere>',                                                                                       β”‚
  _auth: '<secret>',                                                            β”‚
  'always-auth': true }                                                                                         β”‚
✨  Done in 0.05s.

make sure you got the correct formatting on .yarnrc don't put = between registry and url.

there is a pull request at the moment that would probably fix this #774

Guys, how to set false value with yarn config set? It's saved as string. Sorry for off topic.

This issue can be closed
Merge #712 fixes this.
Other related issues/pr: #775 #774

@laubstein This issue is about more than just issues with URL resolution. The config in the description included always-auth and _auth options, which are not implemented. #839 adds support for these options, which is hopefully the last set of changes needed to get this config working.

This now works for me in yarn 0.16.1.

I am still having the issue with this, I tried to put "//" at the end of the .yarnrc file but it is not working for me.

What worked for me as having only an .npmrc file in the following format:

registry=https://nexus.someurl.co.uk/repository/npm-group/
_authToken=NpmToken.1223-636-3647-8373
always-auth=true

@matthewblewitt Thank you for your response! Yes, it was due to token expiration for the registry.

Was this page helpful?
0 / 5 - 0 ratings