near / cargo-near

Cargo extension for building Rust smart contracts on NEAR
Apache License 2.0
33 stars 16 forks source link

`cargo install cargo-near` fails with a compilation error #151

Closed jancionear closed 1 month ago

jancionear commented 4 months ago

I'm trying to install cargo-near, but I get the following compilation error:

$ cargo install cargo-near
...
   Compiling cargo-near v0.6.2
error[E0609]: no field `build_command_args` on type `&commands::deploy::InteractiveClapContextScopeForContract`
  --> /home/jan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-near-0.6.2/src/commands/deploy/mod.rs:29:57
   |
29 |         let file_path = build_command::build::run(scope.build_command_args.clone())?.path;
   |                                                         ^^^^^^^^^^^^^^^^^^ unknown field
   |
   = note: available field is: `contract_account_id`

error[E0560]: struct `commands::deploy::InteractiveClapContextScopeForContract` has no field named `build_command_args`
  --> /home/jan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-near-0.6.2/src/commands/deploy/mod.rs:90:13
   |
90 |             build_command_args,
   |             ^^^^^^^^^^^^^^^^^^ `commands::deploy::InteractiveClapContextScopeForContract` does not have this field
   |
   = note: all struct fields are already assigned

Some errors have detailed explanations: E0560, E0609.
For more information about an error, try `rustc --explain E0560`.
error: could not compile `cargo-near` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-near v0.6.2`, intermediate artifacts can be found at `/tmp/cargo-install1JgOg1`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Looks like there's something wrong with the crate :thinking:

jancionear commented 4 months ago

Cloning the repository and running cargo build works fine, so it must be something specific to cargo install :thinking:

jancionear commented 4 months ago

Refs: https://github.com/near/cargo-near/issues/141

jancionear commented 4 months ago

Workaround (manual installation):

git clone https://github.com/near/cargo-near
cd cargo-near
cargo buld --release
cp target/release/cargo-near ~/.cargo/bin
dj8yfo commented 4 months ago

@jancionear a simpler temporary workaround should be:

cargo install --locked cargo-near

as the current Cargo.lock in main is ok

dj8yfo commented 1 month ago

fixed by #154 and #155