How to best deal with this dependency issue

When I run shards install I get this error about the crystal version:

 Unable to satisfy the following requirements:
  - `crystal (~> 0.35, >= 0.35.0)` required by `lucky 0.23.0+git.commit.2e84ec71ba86601b16af5ec354d103231854b657`
  - `crystal (~> 0.35, >= 0.35.0)` required by `authentic 0.6.1`
  - `crystal (~> 0.35, >= 0.35.0)` required by `carbon 0.1.2`
  - `crystal (~> 0.35, >= 0.35.0)` required by `habitat 0.4.4`
  - `crystal (< 1.0.0)` required by `dotenv 0.7.0`
  - `crystal (~> 0.35, >= 0.35.0)` required by `lucky_flow 0.7.0`
  - `crystal (< 1.0.0)` required by `jwt 1.4.2`
  - `crystal (~> 0.35, >= 0.35.0)` required by `lucky_cli 0.23.1`
  - `crystal (~> 0.35, >= 0.35.1)` required by `wordsmith 0.2.1`
  Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.

Now, to get around this, I know we can run shards install --ignore-crystal-version. The issue I’m faced with is, the shards install command comes from a script that gets ran when you generate a brand new Lucky project. So imagine a person brand new to both Lucky and Crystal. They generate a fresh app and run ./script/setup, and it fails with this error.

I’m wondering how I can handle this before a new person gets to this issue. Do I go through all of our shards and bump the version on all of them to update from 0.35.0, to 0.35.1? Or do I create a new patch release on the one shard that drops the version requirement from 0.35.1 to 0.35.0?

Also, 2 questions about the versions in shards…

  1. Would it be better if they were all crystal: ~> 0.35.0? Would that work?
  2. If I update wordsmith to be, and specify it as a dep using ~> 0.2.0, would that still update? or would I have to specify the dep as ~>
  3. Does the shards override file also handle crystal version?

And that is why we have SHARDS_OPTS env var now. Make SHARDS_OPTS=--ignore-crystal-version and it will pass that option to all invocations.

crystal: ~> 0.35.0 can be used, but is more restricted than crystal: 0.35.0. ~> 0.35.0 is equivalent to >= 0.35.0, < 0.36.

I think that your problem is that the crystal you are using is 1.0.0-dev, which is considered as 1.0.0 and so those dependencies are not candidates. should be candidate when using ~> 0.2.0.

No. They are orthogonal / independant. You will now be using both at the same time, but the override will be used more often than the --ignore-crystal-version IMO.

1 Like

Ah, I didn’t realize that SHARDS_OPTS is passed to all invocations. That might help me here. Thanks!