Skip to content

npm uninstall fails with ERESOLVE: peer dependency conflicts #6486

Description

@acidnik

Description

pi uninstall <npm-package> fails with ERESOLVE could not resolve when any installed package has conflicting peer dependencies on @earendil-works/pi-coding-agent. This makes it impossible to remove packages via the CLI.

Steps to reproduce

  1. Install pi with packages that have overlapping peer dependency ranges for @earendil-works/pi-coding-agent (e.g. pi-powerline-footer requires >=0.74.0 <0.77.0 while @pi-unipi/core requires ^0.78.0)
  2. Run pi uninstall npm:pi-web-access (or any npm-based package)

Expected behavior

pi uninstall removes the package successfully.

Actual behavior

npm uninstall fails with:

npm error ERESOLVE could not resolve
npm error Conflicting peer dependency: @earendil-works/pi-coding-agent@0.76.0
npm error   peer @earendil-works/pi-coding-agent@">=0.74.0 <0.77.0" from pi-powerline-footer@0.6.1

Root cause

uninstallNpm() in package-manager.ts runs:

npm uninstall <name> --prefix <installRoot>

without --legacy-peer-deps, while installNpm() uses getNpmInstallArgs() which does pass --legacy-peer-deps to npm.

Proposed fix

Add --legacy-peer-deps to the npm uninstall command in uninstallNpm():

// current (line ~1491 in dist):
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);

// fixed:
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot, "--legacy-peer-deps"]);

Workaround

Manually remove the package directory from ~/.pi/agent/npm/node_modules/ and delete its entry from the packages array in ~/.pi/agent/settings.json.

Environment

  • installed from AUR (archlinux)
  • @earendil-works/pi-coding-agent@0.80.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions