Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find packages in private npm registry #678

Closed
aherriot opened this issue Oct 11, 2016 · 18 comments
Closed

Cannot find packages in private npm registry #678

aherriot opened this issue Oct 11, 2016 · 18 comments

Comments

@aherriot
Copy link

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.
@Southpaw17
Copy link

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

@ondrejbartas
Copy link

For my config:

==> yarn config list
yarn config v0.15.1
info yarn config
{ email: 'obartas@blueberryapps.com',
  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.

@chrisdhanaraj
Copy link

chrisdhanaraj commented Oct 11, 2016

There's an open work issue on this currently - #521

@aherriot
Copy link
Author

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.

@nickpresta
Copy link

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

@donaldpipowitch
Copy link
Contributor

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.

@serkanyersen
Copy link

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

@Zensavona
Copy link

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 t3-web-admin@0.1.0: 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': 'zen@spruce.ki',                                                                         │
  'init.author.url': 'http://spruce.ki',                                                                        │
  email: 'zen@spruce.ki',                                                                                       │
  _auth: '<somewhere>',                                                            │
  'always-auth': true }                                                                                         │
✨  Done in 0.05s.

@serkanyersen
Copy link

@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

@Zensavona
Copy link

Zensavona commented Oct 12, 2016

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.

@serkanyersen
Copy link

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

@TrySound
Copy link

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

@laubstein
Copy link

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

@also
Copy link

also commented Oct 13, 2016

@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.

@aherriot
Copy link
Author

aherriot commented Oct 23, 2016

This now works for me in yarn 0.16.1.

@Shreyansh259
Copy link

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.

@matthewblewitt
Copy link

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

@Shreyansh259
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests