Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

cmd/launch: check for both npm and git before installing OpenClaw (#14888)

Bruce MacDonald5d0000634c49
diff --git a/cmd/launch/launch_test.go b/cmd/launch/launch_test.go
index f9a9f79a9..359deff37 100644
--- a/cmd/launch/launch_test.go
+++ b/cmd/launch/launch_test.go
@@ -951,7 +951,7 @@ func TestLaunchIntegration_OpenclawInstallsBeforeConfigSideEffects(t *testing.T)
if err == nil {
t.Fatal("expected launch to fail before configuration when OpenClaw is missing")
}
- if !strings.Contains(err.Error(), "npm was not found") {
+ if !strings.Contains(err.Error(), "required dependencies are missing") {
t.Fatalf("expected install prerequisite error, got %v", err)
}
if selectorCalled {
diff --git a/cmd/launch/openclaw.go b/cmd/launch/openclaw.go
index 9285db79b..43e49bf62 100644
--- a/cmd/launch/openclaw.go
+++ b/cmd/launch/openclaw.go
@@ -429,13 +429,17 @@ func ensureOpenclawInstalled() (string, error) {
return "clawdbot", nil
}
- if _, err := exec.LookPath("npm"); err != nil {
- return "", fmt.Errorf("openclaw is not installed and npm was not found\n\n" +
- "Install Node.js first:\n" +
- " https://nodejs.org/\n\n" +
- "Then rerun:\n" +
- " ollama launch\n" +
- "and select OpenClaw")
+ _, npmErr := exec.LookPath("npm")
+ _, gitErr := exec.LookPath("git")
+ if npmErr != nil || gitErr != nil {
+ var missing []string
+ if npmErr != nil {
+ missing = append(missing, "npm (Node.js): https://nodejs.org/")
+ }
+ if gitErr != nil {
+ missing = append(missing, "git: https://git-scm.com/")
+ }
+ return "", fmt.Errorf("openclaw is not installed and required dependencies are missing\n\nInstall the following first:\n %s", strings.Join(missing, "\n "))
}
ok, err := ConfirmPrompt("OpenClaw is not installed. Install with npm?")