coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.68k stars 1.34k forks source link

anchor build.Always reporting errors after downloading is complete:error: no such command: `+solana` Cargo does not handle `+toolchain` directives. Did you mean to invoke `cargo` through `rustup` instead? #3096

Open buoe opened 3 months ago

buoe commented 3 months ago

anchor build.Always reporting errors after downloading is complete:error: no such command: +solana Cargo does not handle +toolchain directives. Did you mean to invoke cargo through rustup instead?

 rustc --version
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)

 anchor --version
anchor-cli 0.30.1

 solana --version
solana-cli 1.17.25 (src:d0ed878d; feat:3580551090, client:SolanaLabs)``

I tried downloading Rust again but it didn't solve the problem

acheroncrypto commented 3 months ago

If you're on macOS, see https://github.com/coral-xyz/anchor/discussions/2831#discussioncomment-8673021

If not, this is likely related to your Solana installation. I'd recommend removing your installation and re-installing v1.18.

anchor build is a wrapper around cargo-build-sbf which comes from Solana's tooling.