尝试在 Ubuntu 上运行锚点,在设置 avm 版本时获取 backtrace=1 输出

尝试在 Ubuntu 上运行锚点,在设置 avm 版本时获取 backtrace=1 输出

我在 Ubuntu 上运行了 rustc、nodejs、yarn、solana-cli,全部都是最新版本,我只需要 anchor,这样我就可以在本地网络上运行 gembank。我可以下载并编译它,但我无法“avm use latest”或类似的东西,否则会得到以下输出。这是我的终端输出。

锚固安装:

strange@Tony:/mnt/c/Users/Reese/OneDrive/Desktop/STRANGE$ cargo install --git https://github.com/project-serum/anchor avm --locked --force
    Updating git repository `https://github.com/project-serum/anchor`
  Installing avm v0.25.0 (https://github.com/project-serum/anchor#205e9d87)
    Updating crates.io index
   Compiling libc v0.2.119
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling log v0.4.14
   Compiling memchr v2.4.1
   Compiling syn v1.0.86
   Compiling pkg-config v0.3.24
   Compiling pin-project-lite v0.2.8
   Compiling cc v1.0.73
   Compiling bytes v1.1.0
   Compiling futures-core v0.3.21
   Compiling itoa v1.0.1
   Compiling version_check v0.9.4
   Compiling futures-task v0.3.21
   Compiling lazy_static v1.4.0
   Compiling foreign-types-shared v0.1.1
   Compiling hashbrown v0.11.2
   Compiling openssl v0.10.38
   Compiling serde_derive v1.0.136
   Compiling fnv v1.0.7
   Compiling futures-util v0.3.21
   Compiling bitflags v1.3.2
   Compiling slab v0.4.5
   Compiling futures-channel v0.3.21
   Compiling once_cell v1.9.0
   Compiling serde v1.0.136
   Compiling futures-sink v0.3.21
   Compiling native-tls v0.2.8
   Compiling tinyvec_macros v0.1.0
   Compiling httparse v1.6.0
   Compiling matches v0.1.9
   Compiling futures-io v0.3.21
   Compiling pin-utils v0.1.0
   Compiling openssl-probe v0.1.5
   Compiling percent-encoding v2.1.0
   Compiling try-lock v0.2.3
   Compiling tower-service v0.3.1
   Compiling serde_json v1.0.79
   Compiling unicode-bidi v0.3.7
   Compiling encoding_rs v0.8.30
   Compiling httpdate v1.0.2
   Compiling ryu v1.0.9
   Compiling semver v1.0.5
   Compiling heck v0.4.0
   Compiling anyhow v1.0.54
   Compiling strsim v0.10.0
   Compiling base64 v0.13.0
   Compiling mime v0.3.16
   Compiling fastrand v1.7.0
   Compiling textwrap v0.14.2
   Compiling remove_dir_all v0.5.3
   Compiling ipnet v2.3.1
   Compiling termcolor v1.1.2
   Compiling indexmap v1.8.0
   Compiling tracing-core v0.1.22
   Compiling openssl-sys v0.9.72
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling foreign-types v0.3.2
   Compiling http v0.2.6
   Compiling tinyvec v1.5.1
   Compiling form_urlencoded v1.0.1
   Compiling tracing v0.1.31
   Compiling http-body v0.4.4
   Compiling unicode-normalization v0.1.19
   Compiling os_str_bytes v6.0.0
   Compiling want v0.3.0
   Compiling quote v1.0.15
   Compiling mio v0.8.0
   Compiling num_cpus v1.13.1
   Compiling socket2 v0.4.4
   Compiling atty v0.2.14
   Compiling tempfile v3.3.0
   Compiling dirs v1.0.5
   Compiling idna v0.2.3
   Compiling tokio v1.17.0
   Compiling url v2.2.2
   Compiling thiserror-impl v1.0.30
   Compiling clap_derive v3.1.0
   Compiling tokio-util v0.6.9
   Compiling h2 v0.3.11
   Compiling tokio-native-tls v0.3.0
   Compiling thiserror v1.0.30
   Compiling clap v3.1.0
   Compiling hyper v0.14.17
   Compiling serde_urlencoded v0.7.1
   Compiling hyper-tls v0.5.0
   Compiling reqwest v0.11.9
   Compiling avm v0.25.0 (/home/strange/.cargo/git/checkouts/anchor-bf03d42499b9267c/205e9d8/avm)
    Finished release [optimized] target(s) in 2m 07s
   Replacing /home/strange/.cargo/bin/anchor
   Replacing /home/strange/.cargo/bin/avm
    Replaced package `avm v0.25.0 (https://github.com/project-serum/anchor#205e9d87)` with `avm v0.25.0 (https://github.com/project-serum/anchor#205e9d87)` (executables `anchor`, `avm`)

##checking if solana is working


strange@Tony:/mnt/c/Users/Reese/OneDrive/Desktop/STRANGE$ anchor --version
Error: Anchor version not set. Please run `avm use latest`.

##setting avm version (where my problem lies)

strange@Tony:/mnt/c/Users/Reese/OneDrive/Desktop/STRANGE$ avm use latest
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("api.github.com")), port: None, path: "/repos/coral-xyz/anchor/tags", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: Temporary failure in name resolution" })) }', src/lib.rs:177:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
   3: avm::fetch_versions
   4: avm::get_latest_version
   5: clap::build::arg::Arg::validator::{{closure}}
   6: clap::parse::validator::Validator::validate
   7: clap::parse::parser::Parser::get_matches_with
   8: clap::parse::parser::Parser::get_matches_with
   9: clap::build::command::App::_do_parse
  10: clap::build::command::App::get_matches_from
  11: avm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

答案1

它对我有用,请尝试直接安装它:

cargo install --git https://github.com/project-serum/anchor anchor-cli --locked

然后尝试anchor --version

如果有效它将返回类似这样的内容anchor-cli 0.25.0

相关内容