yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Contacts registry for workspace package when dependency version is "*"

Open kasbah opened this issue 6 years ago • 2 comments

What is the current behavior?

When I set a dependency of an internal workspace package to any version (an asterisk i.e. "*") yarn tries to find it on the registry and fails.

I have in the root package.json:

"workspaces" : [
    ...
    "packages/urql",
    "services/frontend",
    ...

in packages/urql/package.json I have:

{
  "name": "@kitspace/urql",
  "version": "0.3.0-next1",
  ...

and in services/frontend/package.json I have:

  "dependencies": {
    "@kitspace/after": "*",
    "@kitspace/razzle": "*",
    "@kitspace/urql": "*",
    "create-react-class": "^15.6.3",
    ...

The error with verbose on:

yarn install v1.8.0
verbose 0.428 Checking for configuration file "/tmp/kitspace/.npmrc".
verbose 0.428 Checking for configuration file "/home/kaspar/.npmrc".
verbose 0.428 Checking for configuration file "/home/kaspar/.nvm/versions/node/v8.9.4/etc/npmrc".
verbose 0.429 Checking for configuration file "/tmp/kitspace/.npmrc".
verbose 0.429 Checking for configuration file "/tmp/.npmrc".
verbose 0.43 Checking for configuration file "/tmp/kitspace/.yarnrc".
verbose 0.43 Checking for configuration file "/home/kaspar/.yarnrc".
verbose 0.43 Checking for configuration file "/home/kaspar/.nvm/versions/node/v8.9.4/etc/yarnrc".
verbose 0.43 Checking for configuration file "/tmp/kitspace/.yarnrc".
verbose 0.43 Checking for configuration file "/tmp/.yarnrc".
verbose 0.432 current time: 2018-07-09T23:48:06.310Z
verbose 0.575 Performing "GET" request to "https://yarnpkg.com/latest-version".
[1/4] Resolving packages...
verbose 0.75 Performing "GET" request to "https://registry.yarnpkg.com/@kitspace%2furql".
verbose 2.172 Request "https://yarnpkg.com/latest-version" finished with status code 200.
verbose 3.102 Request "https://registry.yarnpkg.com/@kitspace%2furql" finished with status code 404.
verbose 3.107 Error: Couldn't find package "@kitspace/urql@*" required by "@kitspace/[email protected]" on the "npm" registry.
    at MessageError.ExtendableBuiltin (/usr/share/yarn/lib/cli.js:243:66)
    at new MessageError (/usr/share/yarn/lib/cli.js:272:123)
    at PackageRequest.<anonymous> (/usr/share/yarn/lib/cli.js:36369:17)
    at Generator.throw (<anonymous>)
    at step (/usr/share/yarn/lib/cli.js:98:30)
    at /usr/share/yarn/lib/cli.js:111:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
error Couldn't find package "@kitspace/urql@*" required by "@kitspace/[email protected]" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

If I change the dependency of this package to the specific version 0.3.0-next1 then it links it in fine. The other packages seem to link in fine with a * version.

Steps to reproduce.

git clone --depth=1 https://github.com/monostable/kitspace --branch=yarn-workspaces-reprod
cd kitspace
yarn

What is the expected behavior?

Yarn workspaces does its awesome thing and links in the packages/urql dependency properly.

Please mention your node.js, yarn and operating system version. Node; v8.9.4/v9.4.0 Yarn: 1.7.0/1.8.0 pre-release Ubuntu 16.04

kasbah avatar Jul 09 '18 23:07 kasbah

I have the same issue on yarn 1.22.18. It appears to be related to the -next1 thingy on the dependencies version. * does not seem to match that part for some reason. If I remove whatever is set there it successfully installs. Npm has no issue installing it as is.

vlinder avatar May 27 '22 11:05 vlinder

Can confirm I can still reproduce this with steps from above with yarn 1.22.19.

kasbah avatar May 27 '22 12:05 kasbah