lpm uninstall
Remove project dependencies, global commands, and Swift registry packages.
lpm uninstall removes project dependencies and their installed files, or removes a global command with -g.
lpm uninstall [OPTIONS] [PACKAGES]...
lpm un [OPTIONS] [PACKAGES]...
lpm unlink [OPTIONS] [PACKAGES]...Supply at least one package name. Use the name from package.json, including a local alias, without a version or range.
Quickstart
From the directory with package.json, remove a dependency:
lpm uninstall lodashLPM CLI removes the dependency declaration, its installed package, and its owned commands. It also prunes unused dependencies from a readable lockfile. Commit the updated manifest and lockfiles.
Choose a removal mode
| Goal | Command |
|---|---|
| Remove project dependencies | lpm uninstall react react-dom |
| Remove a global command | lpm uninstall -g typescript |
| Remove a Swift registry dependency | lpm uninstall @lpm.dev/owner.swift-pkg |
| Remove copied source files | lpm remove |
lpm.json has no uninstall configuration block.
Project removal uses package.json and the project lockfile. Workspace members share the root lockfile.
Examples
lpm un react react-dom # remove multiple dependencies
lpm uninstall lodash --filter web # target one workspace member
lpm uninstall -w eslint # target the workspace root
lpm uninstall lodash --filter '*' --yes # target all workspace members
lpm uninstall -g typescript # remove one global packageNon-interactive removal
Use JSON output in scripts:
lpm uninstall lodash --json
lpm uninstall lodash --filter web --fail-if-no-match --yes --jsonProject JSON output contains success, removed, not_found, and target_set.
The target set lists the selected manifest paths.
A successful no-op returns the same fields with empty removal lists.
An unknown project package succeeds and appears in not_found.
An empty workspace selection also succeeds, unless you pass --fail-if-no-match.
That flag checks the workspace selection, not whether each selected project declares the package.
What changes
Project removal updates dependencies and devDependencies.
It preserves optionalDependencies, peerDependencies, and lpm.trustedDependencies.
If an optional declaration still requires a package, its installed files and commands remain.
Required peers also remain while another installed dependency needs them.
Use lpm trust prune to remove stale project trust entries.
With a readable lockfile, LPM CLI removes package records that no remaining dependency needs.
It writes lpm.lock. Current schema 13 uses TOML only; older files retain their legacy format behavior.
If the lockfile is missing or malformed, requested-package removal continues without lockfile pruning.
Cleanup removes the requested package entries and unused matching versions from node_modules.
It removes owned node_modules/.bin commands and empty package-scope directories.
Commands that belong to another package remain.
For LPM.dev Registry packages, cleanup removes intact package skills under .lpm/skills/ after the final direct dependency or alias is removed.
A remaining alias preserves the shared guidance directory. Edited skill files or an invalid ownership manifest stop the cleanup with an error.
lpm uninstall is the only dependency command that removes package skills. Removing a dependency from package.json by hand and running lpm install leaves them in place. Use lpm skills clean to remove them.
Legacy editor cleanup removes matching skill links and preserves regular files and unrelated links.
Package links can point into the shared store. Cleanup removes the links and preserves their targets.
LPM CLI rejects linked node_modules, scope, and .bin parent directories before requested-package cleanup.
These directories must belong to the project. Individual package links remain supported.
Package removal does not clear the shared store. See lpm store for store maintenance.
Workspaces
From a workspace member or its subdirectory, removal targets that member.
At the workspace root, select a member or pass -w:
lpm uninstall lodash --filter web
lpm uninstall lodash --filter '...web' --yes
lpm uninstall lodash --filter-prod '...web' --yes
lpm uninstall -w eslint--filter supports dependency closures and Git changes. --filter-prod excludes development dependencies from closure expansion.
Both flags can repeat. See Workspaces for filter syntax.
For a filter with a Git reference, configure which changes select members:
lpm uninstall lodash --filter '...[main]' \
--changed-files-ignore-pattern '**/*.md' \
--test-pattern '**/*.test.ts' \
--fail-if-no-match --yes-w cannot combine with workspace filters or their change-pattern flags.
Workspace filters require a workspace.
When multiple members are selected and standard input is interactive, LPM CLI asks for confirmation.
--yes, --json, and non-interactive input skip this prompt.
Outside a workspace, removal uses the nearest directory with a package.json, as lpm install does. From a subdirectory, it prints the directory it chose.
Global commands
Remove one global package per command:
lpm uninstall -g typescript
lpm global remove typescriptBoth commands use the same removal behavior. LPM CLI removes the package registration and its owned commands and aliases. When the installation lockfiles are readable, it prunes global script trust entries that no other global install needs.
An unknown global package fails. Global removal rejects workspace flags and --yes.
If another process locks the package files, cleanup can finish during a later global operation.
See lpm global for global paths and command aliases.
Swift packages
Remove a registry dependency by its LPM.dev Registry package name:
lpm uninstall @lpm.dev/owner.swift-pkgLPM CLI removes the registry dependency and its product references from Package.swift.
For an Xcode wrapper, it also removes the related exports.
Then it runs swift package resolve to update Package.resolved.
If Swift resolution fails, LPM CLI restores the manifest and lockfiles. Installed npm files that cleanup already removed can require a new install.
Recovery
If removal reports an incomplete lockfile, restore the install before another attempt:
lpm install
lpm uninstall lodashAfter a failed removal, lpm install also restores missing files from the restored manifest.
If cleanup rejects a linked parent directory, restore a project-local directory before another attempt. Keep shared package targets intact. Individual package links do not require changes.
Flags
| Flag | Effect |
|---|---|
-g, --global | Remove exactly one global package. Reject project flags and --yes. |
--filter <FILTER> | Select workspace members. Can repeat. |
--filter-prod <FILTER_PROD> | Select members with production dependency closures. Can repeat. |
--changed-files-ignore-pattern <CHANGED_FILES_IGNORE_PATTERN> | Ignore matching paths in Git filters. Can repeat. |
--test-pattern <TEST_PATTERN> | Treat matching Git changes as tests, without dependent fan-out from those changes. Can repeat. |
-w, --workspace-root | Target the workspace root manifest. Cannot combine with filters or change-pattern flags. |
--fail-if-no-match | Fail if the workspace selection is empty. |
-y, --yes | Skip confirmation for multiple workspace members. |
See Global flags for --json, verbosity, and other shared flags.
See also
lpm install— install dependencies and restore missing fileslpm remove— remove copied source fileslpm global— manage global commandslpm trust— inspect and prune script trust- Workspaces — select members and dependency closures
- Lockfile — understand the shared dependency record