I'm sorry to hear you're experiencing this issue! From my research, it appears that the Solana Command-Line Tools are not correctly installed, or the path is possibly corrupted, resulting in this error. Let's resolve this.
Here's a step-by-step guide you can follow:
Check if the specified directory actually exists. You can do this using the ls command: [ls -l].
Sometimes, a fresh install can help. Consider uninstalling the current Solana CLI and reinstalling it: [solana-install uninstall].
You can reinstall Solana by executing this command in the terminal: [sh -c "$(curl -sSfL https://release.solana.com/v1.8/install)"].
After the installation is complete, confirm it by typing: [solana --version].
Ensure that the Solana CLI and its associated tools are in your system's PATH. After installing Solana CLI, typically you'd add its path to your .bashrc or .zshrc (or equivalent for your shell). Example: [echo 'export PATH="/home/quang/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bashrc]. Remember to source the file afterward: [source ~/.bashrc].
Open the Solana Rust tutorial again and try to execute the same commands. The error should no longer show up.
Please note that Solana programs are written in Rust, so make sure you have a properly functioning Rust environment. Install Rust using rustup: [curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh].
Happy coding. 🙂 (Run the codes inside the square braces [])
My references: