报错命令:
cargo install --force --locked cargo-contract --version 1.5.0
报错信息:
error: failed to run custom build command for `cargo-contract v1.5.0`
Caused by:
process didn't exit successfully: `/tmp/cargo-installPoUW8y/release/build/cargo-contract-219601312e397f60/build-script-build` (exit status: 1)
--- stdout
cargo:warning=Git command failed with status: exit status: 128
cargo:rustc-env=CARGO_CONTRACT_CLI_IMPL_VERSION=1.5.0-unknown-x86_64-unknown-linux-gnu
cargo:warning=Could not find `.git/HEAD` searching from `/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0` upwards!
Creating template zip: template_dir '/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/templates/new', destination archive '/tmp/cargo-installPoUW8y/release/build/cargo-contract-85ed6dd04fe1327e/out/template.zip'
Done: /home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/templates/new written to /tmp/cargo-installPoUW8y/release/build/cargo-contract-85ed6dd04fe1327e/out/template.zip
Setting cargo working dir to '/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/ink_linting'
Invoking cargo: "cargo" "build" "--release" "--locked" "--target-dir=/tmp/cargo-installPoUW8y/release/build/cargo-contract-85ed6dd04fe1327e/out" "--manifest-path=/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/ink_linting/Cargo.toml"
error: failed to get `clippy_utils` as a dependency of package `ink_linting v0.1.0 (/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/ink_linting)`
Caused by:
failed to load source for dependency `clippy_utils`
Caused by:
Unable to update https://github.com/rust-lang/rust-clippy?rev=0cb0f7636851f9fcc57085cf80197a2ef6db098f#0cb0f763
Caused by:
failed to clone into: /home/echo/.cargo/git/db/rust-clippy-4b72815e96774b3d
Caused by:
process didn't exit successfully: `git fetch --force --update-head-ok 'https://github.com/rust-lang/rust-clippy' '+0cb0f7636851f9fcc57085cf80197a2ef6db098f:refs/commit/0cb0f7636851f9fcc57085cf80197a2ef6db098f'` (exit status: 128)
--- stderr
error: 预期仍然需要 1330 个字节的正文
fetch-pack: unexpected disconnect while reading sideband packet
fatal: 过早的文件结束符(EOF)
fatal: fetch-pack:无效的 index-pack 输出
Encountered error: `"cargo" "build" "--release" "--locked" "--target-dir=/tmp/cargo-installPoUW8y/release/build/cargo-contract-85ed6dd04fe1327e/out" "--manifest-path=/home/echo/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/cargo-contract-1.5.0/ink_linting/Cargo.toml"` failed with exit code: Some(101)
error: failed to compile `cargo-contract v1.5.0`, intermediate artifacts can be found at `/tmp/cargo-installPoUW8y`
解决方法:
rustup update
重新cargo install,成功