I’m having trouble with my Solana NFT project using Anchor. When I try to build it, I get an error about the Rust version. Here’s what’s happening:
The anchor build command fails with a message saying I need rustc 1.75.0 or newer. But I’m actually using rustc 1.77.0, which should be new enough.
Here’s what I’ve checked:
- My rustc version is 1.77.0
- Rustup version is 1.27.0
- I’ve run
rustup update to make sure everything’s up to date
- There’s no rust-toolchain.toml file in my project folder
I’m scratching my head over this. Any ideas what could be causing this version mismatch? Has anyone run into something similar with Anchor and Solana projects?
// Example of my Anchor program structure
use anchor_lang::prelude::*;
#[program]
pub mod my_nft_program {
use super::*;
pub fn create_nft(ctx: Context<CreateNFT>, name: String, symbol: String) -> Result<()> {
// NFT creation logic here
Ok(())
}
}
#[derive(Accounts)]
pub struct CreateNFT<'info> {
// Account structs here
}
Any help would be great. Thanks!
yo, i had a similar problem with my solana project. try running rustc --version in your project directory. sometimes theres a weird local config overriding the global one. also, double-check ur PATH - might be pointing to an old rust version. if nothin works, u could try nuking ur rust install and starting fresh. good luck!
hey sparklinggem, that’s a tricky one! have you tried checking if there’s any weird environment variables messing with your rust setup? sometimes that can cause all sorts of funky version issues. also, what about your anchor version? maybe it’s not playing nice with the latest rust? you could try downgrading rust to 1.75.0 just to see if that fixes it. oh, and have you poked around in your cargo.toml? sometimes dependencies can force specific rust versions. btw, your nft code looks cool! what kind of nfts are you planning to make? im super curious now 
It appears that your issue may be due to conflicting Rust installations or environmental misconfigurations rather than the toolchain version itself. I suspect that your path settings might be pointing to an older Rust version, even though you have version 1.77.0 installed. I would recommend verifying the location of your rustc using the command “which rustc” and ensuring that your PATH variable is set correctly. Additionally, consider adding a rust-toolchain.toml file in the project root to enforce the correct version. If these adjustments do not help, a complete reinstallation of Rust and Anchor might be necessary for a clean environment.