2

Using Windows 11, I get this error when trying to use avm install latest

error[E0282]: type annotations needed for `Box<_>`
  --> C:\Users\username\.cargo\registry\src\index.crates.io-6f17d22bba15001f\time-0.3.29\src\format_description\parse\mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `anchor-cli v0.30.1 (https://github.com/coral-xyz/anchor?tag=v0.30.1#e6d7dafe)`, intermediate artifacts can be found at `C:\Users\username\AppData\Local\Temp\cargo-install121ovv`.                        
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Error: Failed to install 0.30.1, is it a valid version?

I'm not really sure how to go about fixing this. Any help would be really appreciated!

1
  • could you share more details about your environment. What version of Solana, Rust are you using. Are you doing this through WSL or windows?
    – Jimii
    Commented Aug 28 at 8:06

5 Answers 5

3

There is some problems with anchor AVM at the moment i think. Try installing it directly:

cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli

1
  • 1
    This one worked for me on macOS 15.2
    – Ralph Tee
    Commented Dec 12 at 7:15
3

Hi you can refer to this github comment. I was setting up avm recently into my new system. After searching a lot i found this comment, which solved the issue.

https://github.com/coral-xyz/anchor/issues/3131#issuecomment-2264178262

0

Windows support isn't all that great with Solana tooling, so first I'd suggest using WSL if you aren't already.

0

Go to the directory where the error is coming from

"C:\Users\username.cargo\registry\src\index.crates.io-6f17d22bba15001f\time-0.3.29\src\format_description\parse\mod.rs:83:9"

Edit the parse_owned function on line 75-88 in the mod.rs file with this:

    pub fn parse_owned<const VERSION: usize>(
    s: &str,
) -> Result<crate::format_description::OwnedFormatItem, crate::error::InvalidFormatDescription> {
    validate_version!(VERSION);
    let mut lexed = lexer::lex::<VERSION>(s.as_bytes());
    let ast = ast::parse::<_, VERSION>(&mut lexed);
    let format_items = format_item::parse(ast);
    let items: Box<[format_item::Item<'_>]> = format_items
        .map(|res| res.map(Into::into))
        .collect::<Result<Vec<_>, _>>()?
        .into_boxed_slice();  // Convert Vec into a boxed slice
    Ok(items.into())
}

Save and try the installation again.

You may encounter warnings like the following:

warning: unexpected cfg condition name: nightly
 --> cli\src\lib.rs:1:13
  |
1 | #![cfg_attr(nightly, feature(proc_macro_span))]
  |             ^^^^^^^
  |

For that, run the following code:

rustup toolchain install nightly
rustup default nightly

You may also encounter environment warnings after this. Just manually add the file path on your machine, like this:

win + R, type sysdm.cpl.

Go to the Advanced tab and click on Environment Variables. Under System variables, scroll down to find Path, then click Edit.

Add the file path:

C:\Users\Username\.avm\bin

Try the installation again.

Restart your terminal and verify installation with:

anchor --version

0

cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli

Running this will solve the issue, as suggested by Jonas H.

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.