fix(install): install camoufox-js@0.11.0 inside daemon package, not globally

This commit is contained in:
2026-06-13 19:25:56 +05:30
parent 9dbffa2d19
commit b05bfa1a40

View File

@@ -222,14 +222,29 @@ install_camoufox_browser() {
return 0 return 0
fi fi
# Step 1: Install npm package # Step 1: Install npm package (daemon)
info "Installing npm package (camoufox-browser@0.1.0)..." info "Installing npm package (camoufox-browser@0.1.0)..."
npm install -g camoufox-browser@0.1.0 2>&1 | tail -3 || { npm install -g camoufox-browser@0.1.0 2>&1 | tail -3 || {
warn "npm install failed. Try manually: npm install -g camoufox-browser@0.1.0" warn "npm install failed. Try manually: npm install -g camoufox-browser@0.1.0"
return 0 return 0
} }
# Step 2: Download browser binary # Step 2: Override bundled camoufox-js@0.9.3 with v0.11.0
# The daemon does: import("camoufox-js") — Node resolves this from
# the daemon's own node_modules/, NOT global node_modules.
# So a global install won't fix it — we must install inside the package.
info "Upgrading bundled camoufox-js to v0.11.0 (daemon dependency)..."
local cb_pkg
cb_pkg="$(npm root -g 2>/dev/null)/camoufox-browser"
if [ -d "$cb_pkg" ]; then
npm install --prefix "$cb_pkg" camoufox-js@0.11.0 2>&1 | tail -3 || {
warn "Failed to upgrade camoufox-js in $cb_pkg"
}
else
warn "Could not find camoufox-browser package directory at $cb_pkg"
fi
# Step 3: Download browser binary
info "Downloading Camoufox browser binary (~311MB)..." info "Downloading Camoufox browser binary (~311MB)..."
npx --yes camoufox-js@0.11.0 fetch 2>&1 || { npx --yes camoufox-js@0.11.0 fetch 2>&1 || {
warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch" warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch"