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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
美团技术团队
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
The Cloudflare Blog
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
罗磊的独立博客
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
GbyAI
GbyAI
腾讯CDC
MongoDB | Blog
MongoDB | Blog

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(installer): load nvm before node detection · openclaw...
steipete · 2026-04-26 · via Recent Commits to openclaw:main

@@ -1,22 +1,23 @@

11

import { spawnSync } from "node:child_process";

2-

import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";

2+

import { chmodSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";

33

import { tmpdir } from "node:os";

44

import { join } from "node:path";

55

import { describe, expect, it } from "vitest";

6677

const SCRIPT_PATH = "scripts/install.sh";

889-

function runInstallShell(script: string) {

9+

function runInstallShell(script: string, env: NodeJS.ProcessEnv = {}) {

1010

return spawnSync("bash", ["-c", script], {

1111

encoding: "utf8",

1212

env: {

1313

...process.env,

1414

OPENCLAW_INSTALL_SH_NO_RUN: "1",

15+

...env,

1516

},

1617

});

1718

}

181919-

describe("install.sh apt behavior", () => {

20+

describe("install.sh", () => {

2021

const script = readFileSync(SCRIPT_PATH, "utf8");

21222223

it("runs apt-get through noninteractive wrappers", () => {

@@ -41,6 +42,71 @@ describe("install.sh apt behavior", () => {

4142

'run_quiet_step "Configuring NodeSource repository" sudo -E bash "$tmp"',

4243

);

4344

});

45+46+

it("loads nvm before checking Node.js so stale system Node does not win", () => {

47+

expect(script).toMatch(

48+

/# Step 2: Node\.js\s+load_nvm_for_node_detection\s+if ! check_node; then/,

49+

);

50+51+

const tmp = mkdtempSync(join(tmpdir(), "openclaw-install-nvm-"));

52+

const home = join(tmp, "home");

53+

const systemBin = join(tmp, "system-bin");

54+

const nvmBin = join(home, ".nvm/versions/node/v22.22.1/bin");

55+

mkdirSync(systemBin, { recursive: true });

56+

mkdirSync(nvmBin, { recursive: true });

57+

mkdirSync(join(home, ".nvm"), { recursive: true });

58+59+

const systemNode = join(systemBin, "node");

60+

const nvmNode = join(nvmBin, "node");

61+

writeFileSync(systemNode, "#!/bin/sh\necho v8.11.3\n");

62+

writeFileSync(nvmNode, "#!/bin/sh\necho v22.22.1\n");

63+

chmodSync(systemNode, 0o755);

64+

chmodSync(nvmNode, 0o755);

65+

writeFileSync(

66+

join(home, ".nvm/nvm.sh"),

67+

[

68+

'NVM_DIR="${NVM_DIR:-$HOME/.nvm}"',

69+

"export NVM_DIR",

70+

"nvm() {",

71+

' if [ "$1" = "use" ]; then',

72+

' export PATH="$NVM_DIR/versions/node/v22.22.1/bin:$PATH"',

73+

" return 0",

74+

" fi",

75+

" return 0",

76+

"}",

77+

"",

78+

].join("\n"),

79+

);

80+81+

let result: ReturnType<typeof runInstallShell> | undefined;

82+

try {

83+

result = runInstallShell(

84+

[

85+

`cd ${JSON.stringify(process.cwd())}`,

86+

`source ${JSON.stringify(SCRIPT_PATH)}`,

87+

"set +e",

88+

"load_nvm_for_node_detection",

89+

"check_node",

90+

"status=$?",

91+

'printf "status=%s\\npath=%s\\nversion=%s\\n" "$status" "$(command -v node)" "$(node -v)"',

92+

"exit $status",

93+

].join("\n"),

94+

{

95+

HOME: home,

96+

PATH: `${systemBin}:/usr/bin:/bin`,

97+

TERM: "dumb",

98+

},

99+

);

100+

} finally {

101+

rmSync(tmp, { force: true, recursive: true });

102+

}

103+104+

expect(result?.status).toBe(0);

105+

const output = result?.stdout ?? "";

106+

expect(output).toContain("status=0");

107+

expect(output).toContain(`path=${nvmNode}`);

108+

expect(output).toContain("version=v22.22.1");

109+

});

44110

});

4511146112

describe("install.sh macOS Homebrew Node behavior", () => {