Troubleshooting Guide - Common Testship Issues and Solutions
Common Issues
Section titled “Common Issues”Installation Issues
Section titled “Installation Issues”Cannot find module ‘testship’
Section titled “Cannot find module ‘testship’”Problem: After installing, running testship
results in “command not found” or similar error.
Solutions:
-
Use npx instead (recommended):
Terminal window npx @blockchain-hq/testship@latest startThis bypasses global installation issues entirely and always uses the latest version.
-
Verify installation:
Terminal window npm list -g @blockchain-hq/testship -
Reinstall globally:
Terminal window npm install -g @blockchain-hq/testship -
Check npm global path:
Terminal window npm config get prefixEnsure this directory is in your
PATH
.
Permission errors during installation
Section titled “Permission errors during installation”Problem: EACCES
or permission denied errors when installing globally.
Solutions:
-
Use a Node version manager (recommended):
-
Fix npm permissions:
Terminal window mkdir ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrc -
Use sudo (not recommended):
Terminal window sudo npm install -g @blockchain-hq/testship
Project Detection Issues
Section titled “Project Detection Issues””No Anchor project found”
Section titled “”No Anchor project found””Problem:
Error: No Anchor project found. Please run from Anchor project directory.
Checklist:
- ✅ You’re in the root directory of your Anchor project
- ✅
Anchor.toml
file exists in the current directory - ✅ Not in a subdirectory like
programs/
ortests/
Solution:
# Navigate to project rootcd /path/to/your/anchor/project
# Verify Anchor.toml existsls Anchor.toml
# Now start TestShipnpx @blockchain-hq/testship@latest start
“No IDL directory found”
Section titled ““No IDL directory found””Problem:
Error: No IDL directory found.
Please run: anchor build
Causes:
- Program hasn’t been built yet
- Build failed previously
target/
directory was deleted
Solution:
# Build your Anchor programanchor build
# Verify IDL was generatedls target/idl/
# Start TestShipnpx @blockchain-hq/testship@latest start
“No IDL files found”
Section titled ““No IDL files found””Problem:
Error: No IDL files found.
Please run: anchor build
Causes:
- Build completed but didn’t generate IDL
- Program has compilation errors
- IDL generation was skipped
Solution:
# Clean and rebuildanchor cleananchor build
# Check for errors in the build output# Fix any compilation errors in your program
# Verify IDL existsls target/idl/*.json
# Start TestShipnpx @blockchain-hq/testship@latest start
Server Issues
Section titled “Server Issues”Port already in use
Section titled “Port already in use”Problem: Port 3000 is already occupied by another service.
Solution:
Use a different port:
npx @blockchain-hq/testship@latest start --port 8080
Or find and kill the process using port 3000:
# macOS/Linuxlsof -ti:3000 | xargs kill -9
# Windowsnetstat -ano | findstr :3000taskkill /PID <PID> /F
Browser doesn’t open automatically
Section titled “Browser doesn’t open automatically”Problem: TestShip starts but browser doesn’t open.
Solution:
Manually open your browser and navigate to:
http://localhost:3000
Or the port you specified:
http://localhost:8080
UI shows “Cannot connect to server”
Section titled “UI shows “Cannot connect to server””Problem: Browser opens but shows connection error.
Checklist:
- Check if the server is actually running in the terminal
- Verify no errors in the terminal output
- Try refreshing the browser
- Check the correct port is being used
Solution:
# Stop the server (Ctrl+C)# Restartnpx @blockchain-hq/testship@latest start# or if installed globallytestship start
IDL Issues
Section titled “IDL Issues”IDL fails to load in UI
Section titled “IDL fails to load in UI”Problem: UI loads but shows “Error loading IDL” or similar message.
Causes:
- IDL file is corrupted
- IDL has invalid JSON syntax
- File permissions issue
Solution:
-
Verify IDL is valid JSON:
Terminal window cat target/idl/your_program.json | jq . -
Rebuild program:
Terminal window anchor cleananchor build -
Check file permissions:
Terminal window ls -la target/idl/
IDL doesn’t update after code changes
Section titled “IDL doesn’t update after code changes”Problem: Made changes to program but UI shows old version.
Solution:
-
Rebuild your program:
Terminal window anchor build -
Restart TestShip:
Terminal window # Stop server (Ctrl+C)npx @blockchain-hq/testship@latest start -
Hard refresh browser:
- Chrome/Firefox:
Ctrl+Shift+R
(Windows/Linux) orCmd+Shift+R
(macOS) - Safari:
Cmd+Option+R
- Chrome/Firefox:
Multiple Programs
Section titled “Multiple Programs”Wrong program is selected
Section titled “Wrong program is selected”Problem: TestShip is testing the wrong program from your workspace.
Solution:
When you start TestShip, you’ll see a selection prompt if multiple programs exist:
$ npx @blockchain-hq/testship@latest start? Found multiple Anchor programs. Select one:❯ program_one program_two program_three
Use arrow keys to select the correct program.
Program doesn’t appear in selection
Section titled “Program doesn’t appear in selection”Problem: Expected program isn’t listed in the selection menu.
Causes:
- Program wasn’t built
- IDL wasn’t generated
- Program name mismatch
Solution:
-
List your programs:
Terminal window ls target/idl/ -
Verify program in Anchor.toml:
[programs.localnet]your_program = "YourProgramID111111111111111111111111111" -
Build specific program:
Terminal window anchor build -p your_program
Getting Help
Section titled “Getting Help”If you’re still experiencing issues:
- Check the Terminal Output: Look for detailed error messages
- Verify Prerequisites: Ensure Rust, Solana CLI, and Anchor are properly installed
- Update Dependencies: Make sure you’re using the latest version of TestShip
- Community Support:
- Follow us on X: @testshipxyz
- Visit: testship.xyz
Reporting Bugs
Section titled “Reporting Bugs”When reporting issues, please include:
- TestShip version (
testship --version
) - Node.js version (
node --version
) - Anchor version (
anchor --version
) - Operating system
- Complete error message
- Steps to reproduce
Next Steps
Section titled “Next Steps”- Review CLI Reference
- Check API Reference
- Read the Quick Start Guide