I am writing an NFT program in Anchor framework in Solana blockchain.
However, when I tried to build the program using the anchor build
command, it always results with an error.
The error is:
error: package `solana-program v1.18.11` cannot be built because it requires rustc 1.75.0 or newer, while the currently active rustc version is 1.72.0-dev
Either upgrade to rustc 1.75.0 or newer, or use
cargo update -p solana-program@1.18.11 --precise ver
where `ver` is the latest version of `solana-program` supporting rustc 1.72.0-dev
joshi@Joshis-MBP future-play-nft-anchor-solana % rustup update stable
The current rustc version that I am using is
rustc --version
rustc 1.77.0 (aedd173a2 2024-03-17)
And, the rustup version that comes after executing the rustup -V
command is:
rustup 1.27.0 (bbb9276d2 2024-03-08)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.77.0 (aedd173a2 2024-03-17)`
I have already executed rustup update
command to ensure that I using the latest version.
Also, this is a sneak peek to my directory structure:
.
As you can see, there is no rust-toolchain.toml file in my directory.
Can someone please help me overcome this error? Let me know if you need any more information on the context, I will be happy to provide more.
First use this command to get you solana version: solana --version
Then use this command : cargo update -p solana-program@1.18.12 --precise 1.17.25 (use your solana --version output value)
In case it won't work then install solana stable version and command for the same is : sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
and then proceed with the same steps as above one.