Yarn: "Couldn't find package" error when using Yarn with Artifactory

Created on 14 Oct 2016  路  8Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?

Bug

What is the current behavior?

Attempting to use yarn with an existing package.json, configuring it to install from an Artifactory-based virtual NPM repo. This sits in front of a caching NPM repo (that caches public NPM packages) and an internal NPM repo (that contains private packages developed in-house)

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

If the current behavior is a bug, please provide the steps to reproduce.

yarn config set registry http://<my-company-artifactory>:8081/artifactory/npm/npm-virtual

Also tried creating a .yarnrc with

registry http://<my-company-artifactory>:8081/artifactory/npm/npm-virtual

Then ran

yarn

on a project with an existing package.json containing a mix of public and private NPM dependencies. All the dependencies are available and installable using NPM.

What is the expected behavior?

  • Package should have been found; it's available both on the public NPM registry as well as our internal caching repo. npm install is able to find and install it with the registry config settings described above.
  • Error message is confusing. My private registry is called npm-virtual but the message makes it seem like it's searching the public NPM registry. Expected it to say "Couldn't find package on the npm-virtual registry"

Please mention your node.js, yarn and operating system version.

$ node -v
   v6.8.0
$ yarn --version
   0.15.1

Mac OS X 10.11.6 (El Capitan)

cat-bug

Most helpful comment

Set the url with double slash at the end seems to work:

yarn config set registry https://artifactory.company.com/artifactory/api/npm/npm-virtual//

All 8 comments

I have the same problem, any workaround to deal with it?

Set the url with double slash at the end seems to work:

yarn config set registry https://artifactory.company.com/artifactory/api/npm/npm-virtual//

@singuerinc nice! that worked for me too. How did you find out?

@jogjayr There is another issue talking about private repositories and they manage to fix with the same approach.

Yarn report an error:

"error Couldn't find any versions for github-url-from-username-repo that matches ~1.0.2."

But using npm it works. My .yarnrc is set as bellow:

registry "http://xxx.com"

@huangyingjie I've found that you actually need to do

yarn config set

Instead of setting the value in .yarnrc

@jogjayr still failure

yarn config set registry http://xxxx.com
error Couldn't find any versions for github-url-from-username-repo that matches ~1.0.2. Possible versions: 1.0.1, 1.0.0, 0.2.0, 0.1.0, 0.0.2

What's your Artifactory version? I could not get Yarn to work with Artifactory 4.7.4, but we recently upgraded to 4.14.0 and Yarn seems to be behaving. I don't even need to use the trailing double slash. ...I'm wondering if Artifactory itself might be at fault here?

Was this page helpful?
0 / 5 - 0 ratings