Fix Electron not opening: run npm install on core + check DISPLAY

- 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 <noreply@anthropic.com>
This commit is contained in:
Eli 2026-03-09 13:13:15 +01:00
commit 3a7dfb6b1a
2 changed files with 15 additions and 0 deletions

View file

@ -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"

View file

@ -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"
}