fix: rm bundled camoufox-js instead of --prefix override

This commit is contained in:
2026-06-13 19:42:43 +05:30
parent b05bfa1a40
commit cb77ba84a0

View File

@@ -231,18 +231,19 @@ install_camoufox_browser() {
# Step 2: Override bundled camoufox-js@0.9.3 with v0.11.0 # 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 does: import("camoufox-js") — Node resolves this from
# the daemon's own node_modules/, NOT global node_modules. # the daemon's own node_modules/ FIRST, before checking global.
# So a global install won't fix it — we must install inside the package. # So we must REMOVE the bundled copy so Node falls through to global.
info "Upgrading bundled camoufox-js to v0.11.0 (daemon dependency)..." info "Upgrading bundled camoufox-js to v0.11.0 (daemon dependency)..."
local cb_pkg local cb_pkg
cb_pkg="$(npm root -g 2>/dev/null)/camoufox-browser" cb_pkg="$(npm root -g 2>/dev/null)/camoufox-browser"
if [ -d "$cb_pkg" ]; then if [ -d "$cb_pkg/node_modules/camoufox-js" ]; then
npm install --prefix "$cb_pkg" camoufox-js@0.11.0 2>&1 | tail -3 || { rm -rf "$cb_pkg/node_modules/camoufox-js"
warn "Failed to upgrade camoufox-js in $cb_pkg" ok "Removed bundled camoufox-js@0.9.3 from daemon package"
}
else
warn "Could not find camoufox-browser package directory at $cb_pkg"
fi fi
# Ensure global v0.11.0 exists
npm install -g camoufox-js@0.11.0 2>&1 | tail -3 || {
warn "Failed to install camoufox-js@0.11.0 globally"
}
# Step 3: Download browser binary # Step 3: Download browser binary
info "Downloading Camoufox browser binary (~311MB)..." info "Downloading Camoufox browser binary (~311MB)..."