install.sh: hint at root-owned npm cache when desktop npm install fails (#39688)

When apps/desktop's `npm ci`/`npm install` fails, install_desktop printed a
single "Desktop workspace npm install failed" line and aborted, leaving the
user with a wall of raw npm output. A common trigger is a root-owned ~/.npm
cache left by an earlier `sudo npm`/`sudo npx`: the non-root install then
cannot write the shared cache, and npm reports it as EEXIST / "File exists"
while the real errno is EACCES (-13) -- so it reads like an installer bug.

Add a targeted remediation hint on that failure path pointing at:

    sudo chown -R "$(id -un)" ~/.npm && npm cache verify

followed by the manual rebuild command. The stage stays a hard failure by
design (a silent skip yields a "complete" install with no app); only the
failure output changes.
This commit is contained in:
Enes Aydın
2026-06-07 17:55:58 +00:00
committed by GitHub
parent 1892e22acb
commit f3af489ec2
+10
View File
@@ -2307,6 +2307,16 @@ install_desktop() {
log_info "Installing desktop workspace dependencies (includes Electron ~150MB, 1-3min)..."
( cd "$INSTALL_DIR" && npm ci ) || ( cd "$INSTALL_DIR" && npm install ) || {
log_error "Desktop workspace npm install failed"
# Common cause: a previous 'sudo npm'/'sudo npx' left root-owned files in
# ~/.npm, so this non-root install can't write the shared cache. npm hides
# it behind a confusing EEXIST / "File exists" message while the real errno
# is EACCES (-13). Point the user at the fix instead of a raw npm trace.
log_info "If the errors above mention EACCES / 'permission denied' / EEXIST while"
log_info "writing the npm cache, your ~/.npm likely holds root-owned files from an"
log_info "earlier 'sudo npm' or 'sudo npx'. Reclaim ownership and retry:"
log_info " sudo chown -R \"\$(id -un)\" ~/.npm && npm cache verify"
log_info "Then re-run this installer, or build manually:"
log_info " cd \"$INSTALL_DIR\" && npm ci && cd apps/desktop && npm run pack"
return 1
}
log_success "Desktop workspace dependencies installed"