leo remove command removes dependencies from your Leo project’s manifest.
Syntax
Arguments
string
The dependency name to remove. Can be specified with or without
.aleo suffix.Not required when using --all flag.Examples:credits.aleocredits(automatically adds.aleo)
Options
boolean
default:false
Remove all dependencies (or all dev dependencies when used with
--dev).boolean
default:false
Remove from development dependencies instead of regular dependencies.
Examples
Remove Single Dependency
program.json by removing the dependency.
Remove Dependency (Short Syntax)
.aleo:
Remove Local Dependency
Remove All Dependencies
dependencies array in program.json:
Remove Development Dependency
dev_dependencies array only.
Remove All Development Dependencies
dev_dependencies array:
Before and After
Before Removal
program.json:
After Removal
program.json:
Removing Dependencies
By Type
Network Dependency
The
--network flag is optional. Leo automatically detects dependency type.Local Dependency
By Scope
Regular Dependency
Development Dependency
Effect on Build
After removing a dependency:- Is no longer downloaded
- Is not included in the build
- Cannot be imported in Leo code
Before Removal
After Removing my_lib
Common Workflows
Replace Network Dependency with Local
Replace Local Dependency with Network
Clean Up Unused Dependencies
Switch Dependency Versions
Troubleshooting
Dependency Not Found
program.json. Check:
Wrong Scope
Build Failures After Removal
-
Remove import statements:
-
Remove function calls:
-
Re-add the dependency:
Dependency Management Workflow
Development Phase
Testing Phase
Pre-Deployment
Cleanup
Best Practices
1. Clean Imports After Removal
Always update your source code:2. Test After Removal
Always build and test:3. Document Dependency Changes
UpdateREADME.md:
4. Version Control
Commit changes toprogram.json: