Skip to content

Commit

Permalink
some refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
SAMAD101 committed Aug 27, 2024
1 parent c7ea631 commit 5d8d503
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions content/courses/onchain-development/local-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test program to ensure that our setup works.

### Extra steps for Windows users

> MacOS and Linux users can skip this section. Linux and MacOS are the
> macOS and Linux users can skip this section. Linux and MacOS are the
> recommended operating systems for Solana program development. However, if
> you're on Windows, you can still follow along with these extra steps.
Expand Down Expand Up @@ -93,7 +93,7 @@ Afterwards, `anchor -V` should show `anchor-cli 0.30.x` (any number for `x` is
fine) which is the version of the Solana CLI installed in your system indicating
that it was installed successfully.

### Initialize Anchor project
### Create an Anchor project

Create a temporary project, with the default contents, using Anchor and make
sure it compiles and runs our tests:
Expand All @@ -108,30 +108,38 @@ anchor test

**However you may encounter issues, and we'll fix them below:**

- `package `solana-program
#### `package `solana-program
v1.18.12` cannot be built because it requires rustc 1.75.0 or newer` error

This error is due to incompatible versions of `solana-program` and `solana-cli`.
Run `cargo add solana-program@"=1.18.x"`, where `x` matches your version of
`solana-cli`. Then re-run `anchor test`.

- `Error: Unable to read keypair file`
#### `Error: Unable to read keypair file`

Add a keypair to `.config/solana/id.json`. You can either copy a keypair from an
`.env` file (just the array of numbers) into a file or use the command
`solana-keygen new --no-bip39-passphrase` to create a new keypair file. Then
re-run `anchor test`.

- `unused variable: 'ctx'` warning
#### error: no such command: `build-sbf`

This simply means the `initialize` instruction handler isn't doing anything yet.
You can open `programs/favorites/src/lib.rs` and change `ctx` to `_ctx` or just
go onto the next step.
Add this to your `~/.zshrc` or `~/.bashrc` file to make the change permanent.
```bash
export PATH=~"/.local/share/solana/install/active_release/bin:$PATH"
```

#### Unable to get latest blockhash. Test validator does not look started.

- `No license field in package.json` warning
- Install Homebrew and use it to install GNU tar:
```bash
brew install gnu-tar
```

Open package.json, add `"license": "MIT"` or `"license": "UNLICENSED"` depending
on preferences
- Add this to your ~/.zshrc or ~/.bashrc file to make the change permanent.
```bash
export PATH=/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH
```

### All done?

Expand Down

0 comments on commit 5d8d503

Please sign in to comment.