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
- 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)
- 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
Description
pi uninstall <npm-package>fails withERESOLVE could not resolvewhen 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
@earendil-works/pi-coding-agent(e.g.pi-powerline-footerrequires>=0.74.0 <0.77.0while@pi-unipi/corerequires^0.78.0)pi uninstall npm:pi-web-access(or any npm-based package)Expected behavior
pi uninstallremoves the package successfully.Actual behavior
npm uninstallfails with:Root cause
uninstallNpm()inpackage-manager.tsruns:without
--legacy-peer-deps, whileinstallNpm()usesgetNpmInstallArgs()which does pass--legacy-peer-depsto npm.Proposed fix
Add
--legacy-peer-depsto the npm uninstall command inuninstallNpm():Workaround
Manually remove the package directory from
~/.pi/agent/npm/node_modules/and delete its entry from thepackagesarray in~/.pi/agent/settings.json.Environment
@earendil-works/pi-coding-agent@0.80.6