From 74be39e0d53356af11ee8bcc4a58de11d3a346aa Mon Sep 17 00:00:00 2001 From: Tara Menon Date: Sat, 13 Jun 2026 19:25:46 +0530 Subject: [PATCH] fix(install): install camoufox-js@0.11.0 inside daemon package, not globally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: camoufox-browser@0.1.0 bundles camoufox-js@0.9.3. When the daemon does 'import("camoufox-js")', Node.js resolves the BUNDLED version (0.9.3) FIRST — not the global one. Version 0.9.3 doesn't recognize the version.json format from 0.11.0, so it re-downloads the 298MB browser binary on EVERY navigation command, causing timeout -> 'Empty response'. Fix: instead of 'npm install -g camoufox-js@0.11.0' (which Node ignores because bundled takes priority), use: npm install --prefix "$(npm root -g)/camoufox-browser" camoufox-js@0.11.0 This installs v0.11.0 INSIDE the daemon's own node_modules, overriding the bundled 0.9.3. --- install.sh | 19 +++++++++++++++++-- release/install.sh | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 1131dbc..9ade82b 100755 --- a/install.sh +++ b/install.sh @@ -222,14 +222,29 @@ install_camoufox_browser() { return 0 fi - # Step 1: Install npm package + # Step 1: Install npm package (daemon) info "Installing npm package (camoufox-browser@0.1.0)..." 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" 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)..." npx --yes camoufox-js@0.11.0 fetch 2>&1 || { warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch" diff --git a/release/install.sh b/release/install.sh index 1131dbc..9ade82b 100755 --- a/release/install.sh +++ b/release/install.sh @@ -222,14 +222,29 @@ install_camoufox_browser() { return 0 fi - # Step 1: Install npm package + # Step 1: Install npm package (daemon) info "Installing npm package (camoufox-browser@0.1.0)..." 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" 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)..." npx --yes camoufox-js@0.11.0 fetch 2>&1 || { warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch"