Troubleshooting Common Issues
This guide helps you resolve common issues you might encounter when working with Scaffold-Stylus.
1. stylus
Not Recognizedโ
If you encounter an error stating that stylus
is not recognized as an external or internal command, run the following command in your terminal:
sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
After that, check if stylus
is installed by running:
cargo stylus --version
If the version is displayed, stylus
has been successfully installed and the path is correctly set.
2. ABI Not Generatedโ
If you face issues with the ABI not being generated, you can try one of the following solutions:
Restart Docker Node: Pause and restart the Docker node and the local setup of the project. You can do this by deleting all ongoing running containers and then restarting the local terminal using:
yarn run dev
Modify the Script: In the
run-dev-node.sh
script, replace the line:cargo stylus export-abi
with:
cargo run --manifest-path=Cargo.toml --features export-abi
Access Denied Issue: If you encounter an access denied permission error during ABI generation, run the following command and then execute the script again:
sudo chown -R $USER:$USER target
3. Fixing Line Endings and Running Shell Scripts in WSLโ
โ ๏ธ This guide provides step-by-step instructions to resolve the Command not found error caused by CRLF line endings in shell scripts when running in a WSL environment.
Shell scripts created in Windows often have CRLF
line endings, which cause issues in Unix-like environments such as WSL. To fix this:
Using dos2unix
:
Install
dos2unix
(if not already installed):sudo apt install dos2unix
Convert the script's line endings:
dos2unix run-dev-node.sh
Make the Script Executable:
chmod +x run-dev-node.sh
Run the Script in WSL:
bash run-dev-node.sh
4. Network Connection Issuesโ
RPC Endpoint Problemsโ
If you're having trouble connecting to networks:
- Check your RPC URL: Ensure your
RPC_URL_<network>
environment variable is correct - Test network availability: Run
yarn test:networks
to verify available networks - Use fallback RPCs: If your primary RPC is down, the system will automatically use public RPC endpoints
Private Key Issuesโ
If deployment fails due to private key problems:
- Verify private key format: Ensure your private key doesn't include the
0x
prefix - Check account balance: Make sure your account has sufficient funds for deployment
- Network mismatch: Ensure you're using the correct private key for the target network
5. Contract Deployment Failuresโ
Compilation Errorsโ
If your Rust contract fails to compile:
Check Rust toolchain: Ensure you're using the correct Rust version
rustup default 1.87
rustup target add wasm32-unknown-unknown --toolchain 1.87Verify dependencies: Check that all dependencies in
Cargo.toml
are compatibleClean build: Try cleaning and rebuilding
cargo clean
cargo stylus check
6. Frontend Issuesโ
Contract Not Foundโ
If your frontend can't find deployed contracts:
- Check network configuration: Ensure
scaffold.config.ts
has the correcttargetNetworks
- Verify deployment: Check that contracts were deployed to the correct network
- Refresh ABI: Run
yarn export-abi
to regenerate contract interfaces
Wallet Connection Problemsโ
If wallet connection fails:
- Check network: Ensure your wallet is connected to the correct network
- Clear cache: Clear your browser cache and wallet cache
- Check wallet permissions: Ensure your wallet has the necessary permissions
Getting Helpโ
If you're still experiencing issues:
- Check the GitHub Issues for similar problems
- Join the Discord community for real-time help
- Review the Arbitrum Stylus documentation for Stylus-specific issues