I'm trying to build using anchor but there seems to be this error

error: package `toml_datetime v0.6.2` cannot be built because it requires rustc 1.64.0 or newer, while the currently active rustc version is 1.62.0-dev

This is my current dependencies in cargo.toml file

anchor-lang = "0.26.0"
mpl-token-metadata = { version="1.9.0", features = [ "no-entrypoint" ] }
spl-token-2022 = { version = "0.5.0", features = ["no-entrypoint"], optional = true }
spl-associated-token-account = { version = "1.1.1", features = ["no-entrypoint"], optional = true }
anchor-spl = "0.26.0"

My environment solana: solana-cli 1.15.2 rustc: rustc 1.69.0 anchor: anchor-cli 0.27.0 cargo: cargo 1.69.0

Things I've tried:

  • Adding winnow = "=0.4.1" to cargo.toml
  • changing solana-cli version to 1.14.10 and 1.14.18

3 Answers 3


The easiest way to fix this problem is to use the latest version of anchor-spl from GitHub, you can achieve this by adding the following line to your Cargo.toml.

anchor-spl = { git = "https://github.com/coral-xyz/anchor" }

See https://solana.stackexchange.com/a/6535/471 for more information on why this is happening.


cargo build-sbf -- --ignore-rust-version

  • Can you expand on the answer? The command is good, but just add some text describing what it does and why it helps. Thanks!
    – mikemaccana
    Mar 18 at 16:07
  • Hello, I don't really remember where did I found the answer it was almost a year ago!. But remember that it was due to two different build-... I have line with sbf. Unfortunately I don't have time to search all over again. Because of -1 for reputation I even regret that I post this one. Thank you.
    – dobhareach
    Mar 20 at 18:15
  • Here I’ve modded you back up to zero if that helps.
    – mikemaccana
    Mar 20 at 20:48

Ran into this exact error for a while today until I stumbled on this GitHub issue. This is the exact configuration that resolved it for me.


anchor --version anchor-cli 0.27.0

solana --version solana-cli 1.14.17

rustc --version rustc 1.70.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.