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
@@ -722,6 +722,19 @@ Content`,
);
});
it("should pass legacy peer deps when uninstalling npm packages", async () => {
mkdirSync(join(agentDir, "npm"), { recursive: true });
const runCommandSpy = vi.spyOn(packageManager as any, "runCommand").mockResolvedValue(undefined);
await packageManager.remove("npm:@scope/pkg");
expect(runCommandSpy).toHaveBeenCalledWith(
"npm",
["uninstall", "@scope/pkg", "--prefix", join(agentDir, "npm"), "--legacy-peer-deps"],
undefined,
);
});
it("should use bun --cwd for npm package installs", async () => {
settingsManager = SettingsManager.inMemory({
npmCommand: ["mise", "exec", "bun@1", "--", "bun"],