add legacy-peer-deps flag on pi uninstall when using npm (#6604)

otherwise it would fail when there's conflicting peer dependencies in installed packages

fixes: #6486
This commit is contained in:
David Brailovsky
2026-07-13 12:50:46 +02:00
committed by GitHub
parent f8f75544b6
commit b084d2fb39
2 changed files with 20 additions and 2 deletions
@@ -1805,11 +1805,16 @@ export class DefaultPackageManager implements PackageManager {
if (!existsSync(installRoot)) {
return;
}
if (this.getPackageManagerName() === "bun") {
const packageManagerName = this.getPackageManagerName();
if (packageManagerName === "bun") {
await this.runNpmCommand(["uninstall", source.name, "--cwd", installRoot]);
return;
}
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
const args = ["uninstall", source.name, "--prefix", installRoot];
if (packageManagerName !== "pnpm") {
args.push("--legacy-peer-deps");
}
await this.runNpmCommand(args);
}
private async installGit(source: GitSource, scope: SourceScope): Promise<void> {