rustsolanaanchor-solana

Error when running anchor test - rust directory not found


On running the command anchor test it keeps returning an error.

error: not a directory: '/home/dhruv/.local/share/solana/install/releases/1.18.2/solana-release/bin/sdk/sbf/dependencies/platform-tools/rust/bin'

However, in the location /home/dhruv/.local/share/solana/install/releases/1.18.2/solana-release/bin/sdk/sbf/dependencies/platform-tools/rust/ there only a lib folder in there.

I have uninstalled and re-installed it multiple times. Cleared all possible caches, the error keeps persisting.

installed using rustup, using the stable toolchain, I can run

Adding my PATH variable /home/dhruv/.local/share/solana/install/active_release/bin:/home/dhruv/.sdkman/candidates/java/current/bin:/home/dhruv/.nvm/versions/node/v21.6.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/dhruv/Android/Sdk/emulator:/home/dhruv/Android/Sdk/platform-tools:/home/dhruv/Android/Sdk/tools:/home/dhruv/Android/Sdk/tools/bin:/home/dhruv/Android/Sdk/cmdline-tools/latest/bin:/home/dhruv/.cargo/bin:/home/dhruv/.avm/bin

What should the solana file structure look like after a proper install? Where is the bin folder located?


Solution

  • The simple fix was to delete everything in the folder /home/<USER>/.local/share/solana/install/releases/1.18.2/solana-release/bin/sdk/sbf/dependencies/platform-tools/ and then run anchor test again.

    I saw this error with other colleagues as well - the error occurs due to improper unpacking of the tar file in platform-tools. You could also try manually unpacking the tar file again.