How to solve `shard name (?) has ambiguous sources: ...` error?

My project add two shards, one of them depend on the https://github.com/schovi/baked_file_system.git, but another one depend on the https://github.com/ralsina/baked_file_system.git, both dependency use same name, latter is the fork of the former.

then i get error like following when shards install.

Error shard name (baked_file_system) has ambiguous sources:
 'git: https://github.com/schovi/baked_file_system.git' and 
'git: https://github.com/ralsina/baked_file_system.git'.

How to solve this issue?

Thanks.

Is it possible to only use one of them?

You cannot use two shards with same name but different repositories. Also, both are exposing the same entry point, which will affect require.

I would recommend you pick one or the other as second one is a fork of the first one.

https://crystal-lang.org/reference/1.12/man/shards/index.html#fixing-dependency-version-conflicts

1 Like

It works, I’ve never realized that this hack could also be used to change shard‘s dependencies.

Add shard.override.yml like this works!

dependencies:
  baked_file_system:
    github: schovi/baked_file_system

I suggest you use the other one, it’s the exact same code with a bugfix :slight_smile:

It’s seem like just not get hidden file/folder baked into binary, this behavior is expected, those codes were added intentionally, to avoid the user added hidden user data to the binary accidentally, i consider it is not a bug.

1 Like