From 3a7dfb6b1ac76b41ffec5aab58989977cfebd386 Mon Sep 17 00:00:00 2001 From: Karamelmar Date: Mon, 9 Mar 2026 13:13:15 +0100 Subject: [PATCH] Fix Electron not opening: run npm install on core + check DISPLAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - core.sh: run npm install after cloning (downloads Electron binary into app/node_modules — required for the UI to launch) - start.sh template: check if app/node_modules exists and run npm install on first start if missing - start.sh template: warn if DISPLAY/WAYLAND_DISPLAY not set Co-Authored-By: Claude Sonnet 4.6 --- lib/container.sh | 12 ++++++++++++ lib/core.sh | 3 +++ 2 files changed, 15 insertions(+) diff --git a/lib/container.sh b/lib/container.sh index 3fe271a..11072fb 100644 --- a/lib/container.sh +++ b/lib/container.sh @@ -100,6 +100,18 @@ if ! "\$RUNTIME" container inspect "\$CONTAINER_NAME" --format '{{.State.Running echo "Error: container failed to start." >&2; exit 1 fi +# ── Ensure core deps are installed (Electron binary lives here) ───────── +if [[ ! -d "\$CS_CORE/app/node_modules" ]]; then + echo "→ Installing context-studio-core dependencies (first run)..." + (cd "\$CS_CORE" && npm install) || { echo "npm install failed." >&2; exit 1; } +fi + +# ── Check display for Electron UI ─────────────────────────────────────── +if [[ -z "\${DISPLAY:-}" && -z "\${WAYLAND_DISPLAY:-}" ]]; then + echo "⚠ No display detected (DISPLAY / WAYLAND_DISPLAY not set)." + echo " Electron UI may not open. Set DISPLAY=:0 or run from a desktop terminal." +fi + # ── Put claude wrapper first on PATH ──────────────────────────────────── export PATH="\$PROJECT_DIR/bin:\$PATH" diff --git a/lib/core.sh b/lib/core.sh index 4f4f514..ecb1dbb 100644 --- a/lib/core.sh +++ b/lib/core.sh @@ -24,5 +24,8 @@ setup_core() { spin "Cloning context-studio-core..." \ git clone "$CS_CORE_REPO" "$CS_CORE_DIR" \ || die "Failed to clone context-studio-core. Check your SSH key and network." + spin "Installing core dependencies (npm install)..." \ + bash -c "cd '$CS_CORE_DIR' && npm install" \ + || die "npm install failed for context-studio-core." success "Core installed at $CS_CORE_DIR" }