Skip to main content
The 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.aleo
  • credits (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

Output:
Updates program.json by removing the dependency.

Remove Dependency (Short Syntax)

Automatically appends .aleo:

Remove Local Dependency

Output:

Remove All Dependencies

Output:
Clears the dependencies array in program.json:
This removes ALL dependencies from your project. Use with caution.

Remove Development Dependency

Output:
Removes from dev_dependencies array only.

Remove All Development Dependencies

Output:
Clears the 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:
The removed dependency:
  • Is no longer downloaded
  • Is not included in the build
  • Cannot be imported in Leo code

Before Removal

After Removing my_lib

Error:
You must remove the import and any usage:

Common Workflows

Replace Network Dependency with Local

Replace Local Dependency with Network

Clean Up Unused Dependencies

Switch Dependency Versions

Troubleshooting

Dependency Not Found

The dependency doesn’t exist in program.json. Check:

Wrong Scope

If it’s a dev dependency:

Build Failures After Removal

You removed a dependency but still reference it. Solutions:
  1. Remove import statements:
  2. Remove function calls:
  3. 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

Update README.md:

4. Version Control

Commit changes to program.json:

5. Communicate Changes

For shared projects, notify team members:

Comparison with Add

Advanced Usage

Scripted Dependency Management

Conditional Dependency Removal

Next Steps