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

推荐订阅源

N
Netflix TechBlog - Medium
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
雷峰网
雷峰网
宝玉的分享
宝玉的分享
IT之家
IT之家
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园 - 叶小钗
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
美团技术团队
爱范儿
爱范儿
T
The Blog of Author Tim Ferriss
L
LangChain Blog
U
Unit 42
有赞技术团队
有赞技术团队
博客园_首页

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: warn before npm prefix redirection (#73890) (thanks ...
steipete · 2026-04-30 · via Recent Commits to openclaw:main

@@ -108,6 +108,59 @@ describe("install.sh", () => {

108108

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

109109

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

110110

});

111+112+

it("warns before redirecting an unwritable npm prefix", () => {

113+

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

114+

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

115+

const events = join(tmp, "events.log");

116+

mkdirSync(home, { recursive: true });

117+118+

let result: ReturnType<typeof runInstallShell> | undefined;

119+

try {

120+

result = runInstallShell(`

121+

set -euo pipefail

122+

source "${SCRIPT_PATH}"

123+

OS=linux

124+

HOME=${JSON.stringify(home)}

125+

prefix=${JSON.stringify(join(tmp, "root-owned-prefix"))}

126+

events=${JSON.stringify(events)}

127+

npm() {

128+

if [[ "$1" == "config" && "$2" == "get" && "$3" == "prefix" ]]; then

129+

printf '%s\\n' "$prefix"

130+

return 0

131+

fi

132+

if [[ "$1" == "config" && "$2" == "set" && "$3" == "prefix" ]]; then

133+

printf 'npm-set:%s\\n' "$4" >> "$events"

134+

return 0

135+

fi

136+

return 1

137+

}

138+

ui_info() { printf 'info:%s\\n' "$*" >> "$events"; }

139+

ui_warn() { printf 'warn:%s\\n' "$*" >> "$events"; }

140+

ui_success() { printf 'success:%s\\n' "$*" >> "$events"; }

141+

fix_npm_permissions

142+

cat "$events"

143+

`);

144+

} finally {

145+

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

146+

}

147+148+

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

149+

const lines = (result?.stdout ?? "").trim().split("\n");

150+

const warningIndex = lines.findIndex((line) =>

151+

line.includes("The installer will switch npm's user prefix"),

152+

);

153+

const npmSetIndex = lines.findIndex((line) => line.startsWith("npm-set:"));

154+

const noSudoWarningIndex = lines.findIndex((line) => line.includes("Avoid sudo npm i -g"));

155+

expect(warningIndex).toBeGreaterThanOrEqual(0);

156+

expect(npmSetIndex).toBeGreaterThan(warningIndex);

157+

expect(noSudoWarningIndex).toBeGreaterThan(npmSetIndex);

158+

expect(result?.stdout).toContain("npm global prefix is not writable");

159+

expect(result?.stdout).toContain("npm normally writes that setting to ~/.npmrc");

160+

expect(result?.stdout).toContain("npm i -g openclaw@latest");

161+

expect(result?.stdout).toContain("using this user prefix");

162+

expect(result?.stdout).not.toContain("has been saved");

163+

});

111164

});

112165113166

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