惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
U
Unit 42
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
I
InfoQ
WordPress大学
WordPress大学
H
Help Net Security
D
Docker
B
Blog
腾讯CDC
A
About on SuperTechFans
Recent Announcements
Recent Announcements
雷峰网
雷峰网
有赞技术团队
有赞技术团队
C
Check Point Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(update): avoid per-Node npm prefixes during self-upda...
vincentkoc · 2026-06-16 · via Recent Commits to openclaw:main

@@ -373,6 +373,100 @@ describe("update global helpers", () => {

373373

});

374374

});

375375376+

it("keeps npm ownership but avoids per-Node npm commands for reinstall", async () => {

377+

await withMockedPlatform("darwin", async () => {

378+

await withTempDir({ prefix: "openclaw-update-node-version-prefix-" }, async (base) => {

379+

const pathNpmRoot = path.join(base, "path-npm", "lib", "node_modules");

380+

const layouts = [

381+

{

382+

name: "homebrew-cellar",

383+

prefix: path.join(base, "opt", "homebrew", "Cellar", "node", "24.5.0"),

384+

},

385+

{

386+

name: "nvm",

387+

prefix: path.join(base, "home", ".nvm", "versions", "node", "v24.5.0"),

388+

},

389+

{

390+

name: "asdf",

391+

prefix: path.join(base, "home", ".asdf", "installs", "nodejs", "24.5.0"),

392+

},

393+

{

394+

name: "volta",

395+

prefix: path.join(base, "home", ".volta", "tools", "image", "node", "24.5.0"),

396+

},

397+

{

398+

name: "fnm",

399+

prefix: path.join(

400+

base,

401+

"home",

402+

".local",

403+

"share",

404+

"fnm",

405+

"node-versions",

406+

"v24.5.0",

407+

"installation",

408+

),

409+

},

410+

{

411+

name: "n",

412+

prefix: path.join(base, "usr", "local", "n", "versions", "node", "24.5.0"),

413+

},

414+

];

415+416+

for (const layout of layouts) {

417+

const nodeManagedRoot = path.join(layout.prefix, "lib", "node_modules");

418+

const pkgRoot = path.join(nodeManagedRoot, "openclaw");

419+

const nodeManagedNpm = path.join(layout.prefix, "bin", "npm");

420+

await fs.mkdir(pkgRoot, { recursive: true });

421+

await fs.mkdir(path.dirname(nodeManagedNpm), { recursive: true });

422+

await fs.writeFile(nodeManagedNpm, "", "utf8");

423+424+

const runCommand = createNpmRootRunner({

425+

defaultNpmRoot: pathNpmRoot,

426+

overrideCommand: nodeManagedNpm,

427+

overrideNpmRoot: nodeManagedRoot,

428+

});

429+430+

await expect(

431+

detectGlobalInstallManagerForRoot(runCommand, pkgRoot, 1000),

432+

layout.name,

433+

).resolves.toBe("npm");

434+

await expect(

435+

resolveGlobalRoot("npm", runCommand, 1000, pkgRoot),

436+

layout.name,

437+

).resolves.toBe(pathNpmRoot);

438+

expect(resolveGlobalInstallCommand("npm", pkgRoot), layout.name).toEqual({

439+

manager: "npm",

440+

command: "npm",

441+

});

442+

expect(globalInstallArgs("npm", "openclaw@latest", pkgRoot), layout.name).toEqual([

443+

"npm",

444+

"i",

445+

"-g",

446+

"openclaw@latest",

447+

"--no-fund",

448+

"--no-audit",

449+

"--loglevel=error",

450+

"--min-release-age=0",

451+

]);

452+

expect(globalInstallFallbackArgs("npm", "openclaw@latest", pkgRoot), layout.name).toEqual(

453+

[

454+

"npm",

455+

"i",

456+

"-g",

457+

"openclaw@latest",

458+

"--omit=optional",

459+

"--no-fund",

460+

"--no-audit",

461+

"--loglevel=error",

462+

"--min-release-age=0",

463+

],

464+

);

465+

}

466+

});

467+

});

468+

});

469+376470

it("does not infer npm ownership from path shape alone when the owning npm binary is absent", async () => {

377471

await withTempDir({ prefix: "openclaw-update-npm-missing-bin-" }, async (base) => {

378472

const brewRoot = path.join(base, "opt", "homebrew", "lib", "node_modules");