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"