Overview
Thepm unlink command removes symbolic links created by pm link, restoring packages to their published versions from the registry.
Syntax
Arguments
string[]
Package names or arguments passed to your package manager’s unlink command
Examples
Unlink Specific Package
Output
Unlink All Packages
In the project with linked packages:Output
Remove Global Link
In the package that was globally linked:Output
Use Cases
After Local Development
When you’re done developing locally:1
Unlink Package
Remove the symbolic link:
2
Reinstall from Registry
Install the published version:
3
Verify
Check the package is from registry:
Before Deployment
Ensure no development links exist:Switching Development Setup
Switch from linked to published version:How It Works
Fromsrc/commands/unlink.ts:10-17:
- Detects your package manager
- Passes all arguments to the native unlink command
- Removes symbolic links from node_modules
Package Manager Behavior
Verification
Check if package is still linked:Output (linked)
Output (unlinked)
-> arrow means it’s installed normally.
Restore Published Version
After unlinking, reinstall from registry:Common Workflows
Complete Cleanup
Remove all development links:Switch Between Linked and Published
Verify No Links
Troubleshooting
Package Still Linked
If unlink doesn’t work:-
Manual removal:
-
Clean reinstall:
Global Link Persists
Module Resolution Issues
After unlinking, you may need to:Best Practices
- Unlink before commits - Don’t commit with linked packages
- Document linked packages - Keep track of what’s linked
- Verify after unlink - Check with
pm lsthat links are removed - Clean install after - Run
pm installto restore published versions
Related Commands
- pm link - Create symbolic links
- pm ls - List dependencies and check for links
- pm install - Reinstall packages from registry