kbknapp/cargo-count

unable to install

GopherJ opened this issue ยท 4 comments

    Updating git repository `https://github.com/kbknapp/cargo-count`
  Installing cargo-count v0.2.4 (https://github.com/kbknapp/cargo-count#eebe6f87)
    Updating crates.io index
error: failed to compile `cargo-count v0.2.4 (https://github.com/kbknapp/cargo-count#eebe6f87)`, intermediate artifacts can be found at `/tmp/cargo-installSJ1NfQ`

Caused by:
  failed to select a version for the requirement `clap = "~2.11.2"`
  candidate versions found which didn't match: 2.33.3, 2.33.2, 2.33.1, ...
  location searched: crates.io index
required by package `cargo-count v0.2.4 (/home/cheng/.cargo/git/checkouts/cargo-count-01e28dcffdb7943b/eebe6f8)`

Clap maintainer has yanked all the versions up to 2.21.0 which caused this error. The only option (except waiting for the cargo-count author to update dependency) I can see so far โ€” build it manually and put binary to ~/.cargo/bin.

Fenex commented

Easy install cargo-count with fix #46:

git clone https://github.com/kbknapp/cargo-count.git
cd cargo-count
git fetch origin pull/46/head:pr-46
git checkout pr-46
cargo install --path ./
# ready!
cargo count --all --unsafe-statistics --exclude target

cargo install --git https://github.com/slerpyyy/cargo-count --branch master works as a one liner.

If you want to install from the original repo (rather than a forked one) with a yanked dependency, and assuming the repo has a Cargo.lock file (which it does in this case), you can use the --locked argument, as so:

cargo install --git https://github.com/kbknapp/cargo-count --branch master --locked