Skip to content

bug(dashboard): first launch dies silently when the global npm prefix is root-owned (EACCES on on-demand npm install) #1233

Description

@Fmarzochi

Summary

On a root-owned global npm install (distro Node, sudo npm install -g @egchq/egc), the dashboard dies silently on first launch: egc init prints EGC Dashboard starting at http://localhost:7890, the detached process exits immediately, and the port refuses connections. No error is shown anywhere.

Root cause (confirmed in the field)

Two stacked problems:

  1. Silent by design on the init/install path: scripts/lib/dashboard-launch.js spawns scripts/dashboard.js detached with stdio: 'ignore' and prints the success line before knowing whether the server survived, so any startup failure is invisible. The CLI path (scripts/dashboard.js start) does have a 3 second readiness check; the init/install path has none.
  2. First-launch dependency install inside a root-owned directory: scripts/dashboard.js start runs npm install inside the installed package's dashboard/ directory when dashboard/node_modules is missing. On a root-owned prefix that fails with EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@egchq/egc/dashboard/node_modules'.

Same class of problem as the npm link note fixed in #1231: a step that assumes the package directory is writable.

Evidence

Reported and reproduced by @rathaur-ankit in #1218 (Ubuntu 26.04 LTS, distro Node 22 with npm 9, zsh, sudo npm install -g): initial report, follow-up after egc init, and a foreground run confirming the EACCES with a screenshot. See the thread from #1218 (comment) onward.

Scope note

The dashboard component is under an active architecture decision (rework vs replace), so the fix direction for problem 2 is intentionally left open here. Problem 1 (announcing success with no readiness check on the init/install path) is worth fixing regardless of that decision.

Credit

Found, reproduced and diagnosed in the field by @rathaur-ankit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions