From bf8117ad32e793e2b5980ac291da805ccfee3876 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 19 Feb 2026 18:19:10 +0100 Subject: [PATCH] fix(update): silence npm deprecation/funding noise --- src/infra/update-global.ts | 3 ++- src/infra/update-runner.test.ts | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/infra/update-global.ts b/src/infra/update-global.ts index e22dd3b1d4..a678934b40 100644 --- a/src/infra/update-global.ts +++ b/src/infra/update-global.ts @@ -13,6 +13,7 @@ export type CommandRunner = ( const PRIMARY_PACKAGE_NAME = "openclaw"; const ALL_PACKAGE_NAMES = [PRIMARY_PACKAGE_NAME] as const; const GLOBAL_RENAME_PREFIX = "."; +const NPM_GLOBAL_INSTALL_QUIET_FLAGS = ["--no-fund", "--no-audit", "--loglevel=error"] as const; async function tryRealpath(targetPath: string): Promise { try { @@ -133,7 +134,7 @@ export function globalInstallArgs(manager: GlobalInstallManager, spec: string): if (manager === "bun") { return ["bun", "add", "-g", spec]; } - return ["npm", "i", "-g", spec]; + return ["npm", "i", "-g", spec, ...NPM_GLOBAL_INSTALL_QUIET_FLAGS]; } export async function cleanupGlobalRenameDirs(params: { diff --git a/src/infra/update-runner.test.ts b/src/infra/update-runner.test.ts index c3e563d7b3..df6bdc13ec 100644 --- a/src/infra/update-runner.test.ts +++ b/src/infra/update-runner.test.ts @@ -361,16 +361,16 @@ describe("runGatewayUpdate", () => { it.each([ { title: "updates global npm installs when detected", - expectedInstallCommand: "npm i -g openclaw@latest", + expectedInstallCommand: "npm i -g openclaw@latest --no-fund --no-audit --loglevel=error", }, { title: "uses update channel for global npm installs when tag is omitted", - expectedInstallCommand: "npm i -g openclaw@beta", + expectedInstallCommand: "npm i -g openclaw@beta --no-fund --no-audit --loglevel=error", channel: "beta" as const, }, { title: "updates global npm installs with tag override", - expectedInstallCommand: "npm i -g openclaw@beta", + expectedInstallCommand: "npm i -g openclaw@beta --no-fund --no-audit --loglevel=error", tag: "beta", }, ])("$title", async ({ expectedInstallCommand, channel, tag }) => { @@ -406,7 +406,7 @@ describe("runGatewayUpdate", () => { if (key === "pnpm root -g") { return { stdout: "", stderr: "", code: 1 }; } - if (key === "npm i -g openclaw@latest") { + if (key === "npm i -g openclaw@latest --no-fund --no-audit --loglevel=error") { stalePresentAtInstall = await pathExists(staleDir); return { stdout: "ok", stderr: "", code: 0 }; }