2

I'm trying to build some ink! contract code (this one) but I got this error:

error: There are multiple `parity-scale-codec` packages in your project, and the specification `parity-scale-codec` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  parity-scale-codec:2.3.1
  parity-scale-codec:3.1.0

This is my cargo.toml file:

[package]
name = "nft"
version = "0.1.0"
authors = ["Nick Shulhin (Polk4.net) <[email protected]>"]
edition = "2018"

[dependencies]
ink_primitives = { version = "=3.0.0-rc3", default-features = false }
ink_metadata = { version = "=3.0.0-rc3", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "=3.0.0-rc3", default-features = false }
ink_storage = { version = "=3.0.0-rc3", default-features = false }
ink_lang = { version = "=3.0.0-rc3", default-features = false }

scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] }

[lib]
name = "nft"
path = "lib.rs"
crate-type = [
    # Used for normal contract Wasm blobs.
    "cdylib",
]

[features]
default = ["std"]
std = [
    "ink_metadata/std",
    "ink_env/std",
    "ink_storage/std",
    "ink_primitives/std",
    "scale/std",
    "scale-info/std",
]
ink-as-dependency = []

2
  • 1
    Are you using ink! 3.0.0-rc3 on purpose ? Update it to 3.0.0-rc9 then cargo update and it should work
    – P.Ossun
    Commented Mar 15, 2022 at 11:15
  • We released ink! 3.0 last week, so you should definitely update to that. As for the duplicate packages, an easy "fix" in this case can also be to remove your Cargo.lock file and let Cargo sort everything out from scratch.
    – HCastano
    Commented Mar 22, 2022 at 18:40

1 Answer 1

2

To answer your question - it's because the versions of your ink dependencies are dependent on different versions of your scale dependencies.

As @P.Ossun mentioned, with rc-9 it will work with your scale dependencies, I'm not sure you will even be able to build it with rc-3 if you even adjusted the scale dependencies.

If you will use rc-9, then you will also need to change the version of your package to 2021.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.