Skip to content

Commit

Permalink
update installation page (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYJLiu authored Sep 6, 2024
1 parent 99449bf commit 409da11
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions docs/intro/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,42 @@ You should see output similar to the following:
anchor-cli 0.30.1
```

If you encounter the error `type annotations needed for Box<_>` when installing
the Anchor CLI, try changing your Rust version to 1.79.0 and attempt the
installation again.

<Accordion>
<AccordionItem title="error[E0282]: type annotations needed for `Box<_>`">

```
Compiling time v0.3.29
error[E0282]: type annotations needed for `Box<_>`
--> /home/x/.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
| ++++++++
```

You can find more context regarding this error
[here](https://github.com/coral-xyz/anchor/pull/3143)

</AccordionItem>
</Accordion>

Run the following command to install Rust 1.79.0:

```shell
rustup default 1.79.0
```

When installing the Anchor CLI on Linux or WSL, you may encounter this error:

```
Expand Down Expand Up @@ -383,6 +419,29 @@ You should the following output:
</AccordionItem>
</Accordion>

When running `anchor build`, if you encounter `error: not a directory` similar
following:

```
error: not a directory: '.../solana-release/bin/sdk/sbf/dependencies/platform-tools/rust/lib'
```

Try these solutions:

1. Force install using the following command:

```shell
cargo build-sbf --force-tools-install
```

2. If the above doesn't work, clear the Solana cache:

```shell
rm -rf ~/.cache/solana/*
```

After applying either solution, attempt to run `anchor build` again.

If you are on Linux or WSL and encounter the following errors when running
`anchor test` after creating a new Anchor project, it's may be due to missing
Node.js or Yarn:
Expand Down

0 comments on commit 409da11

Please sign in to comment.