The Crystal Programming Language Forum

Weird "shards outdated" output (Crystal 1.0.0)

Hello!

I have this in my shard.yml:

...
dependencies:
  neo4j:
    github: jgaskins/neo4j.cr
  amqp-client:
    github: cloudamqp/amqp-client.cr
  raven:
    github: Sija/raven.cr

My shard.lock:

...
neo4j:
    git: https://github.com/jgaskins/neo4j.cr.git
    version: 0.6.0
...

shards list output:

...
  * neo4j (0.6.0)
  * amqp-client (0.6.6)
  * amq-protocol (0.3.24)
  * raven (1.9.1)
...

But when I run shards outdated, this is the output:

Unable to satisfy the following requirements:
...
- `crystal (~> 0.27, >= 0.27.0)` required by `neo4j 0.5.5`
Failed to resolve dependencies, try updating incompatible shards or use --ignore-crystal-version as a workaround if no update is available.

Why there is version neo4j 0.5.5 in the output? If I check lib/neo4j/shard.yml file, there is correct 0.6.0 version. I’m confused.

I deleted ~/.cache/crystal and ~/.cache/shards, but still the same output.

Is it a bug?

Ubuntu 20.10

➤  crystal --version
Crystal 1.0.0 [dd40a2442] (2021-03-22)

LLVM: 10.0.0
Default target: x86_64-unknown-linux-gnu

➤  shards --version
Shards 0.14.1 [addc26a] (2021-03-10)

I see it as a bug: https://github.com/crystal-lang/shards/issues/413
but actually this check was added intentionally, so it probably won’t be changed.

The short story is that there was an implicit mandate for developers to explicitly specify that their library works with 1.0.0, or else it will break as shown here.

To just move on with your life:

  • For users:

    • Permanently (I definitely recommend):
      Add into your ~/.bashrc or similar:

      export SHARDS_OPTS=--ignore-crystal-version
      
    • Temporarily: Run shards --ignore-crystal-version instead.

  • For library developers, so your users don’t need to see this:

    • Specify crystal: '>= 0.35.0' in shard.yml if previously you had crystal: 0.35.0.

As for that, it does seem like an actual separate bug.

It happens because you have that version in your shard.lock (or, at least it’s one of the things that I found to cause this):

  neo4j:
    git: https://github.com/jgaskins/neo4j.cr.git
    version: 0.5.5

And I think yes, that message should be based on the actual version, not on the old one in the lock. I made sure to run shards update (not just install) and the message still was like that.

But my shard.lock is correct (included in my original question):

...
neo4j:
    git: https://github.com/jgaskins/neo4j.cr.git
    version: 0.6.0
...

Ah you’re right! It happens to me as well. Don’t have 0.5.5 in any file whatsoever but it still shows that.

OK - reported here: Wrong shard version in "shards outdated" (1.0.0) · Issue #486 · crystal-lang/shards · GitHub

It still blows my mind that you’re using my Neo4j driver in production. My apps using Neo4j haven’t needed updating in a while, so I haven’t been working on it, so this was a fun reminder! :100:

1 Like