Skip to content

Commit 6f50253

Browse files
committed
fix: clarify install switching
1 parent aad7b67 commit 6f50253

6 files changed

Lines changed: 67 additions & 19 deletions

File tree

‎docs/help/faq-first-run.md‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -766,30 +766,32 @@ and troubleshooting see the main [FAQ](/help/faq).
766766
</Accordion>
767767

768768
<Accordion title="Can I switch between npm and git installs later?">
769-
Yes. Install the other flavor, then run Doctor so the gateway service points at the new entrypoint.
770-
This **does not delete your data** - it only changes the OpenClaw code install. Your state
771-
(`~/.openclaw`) and workspace (`~/.openclaw/workspace`) stay untouched.
769+
Yes. Use `openclaw update --channel ...` when OpenClaw is already installed.
770+
This **does not delete your data** - it only changes the OpenClaw code install.
771+
Your state (`~/.openclaw`) and workspace (`~/.openclaw/workspace`) stay untouched.
772772

773773
From npm to git:
774774

775775
```bash
776-
git clone https://github.com/openclaw/openclaw.git
777-
cd openclaw
778-
pnpm install
779-
pnpm build
780-
openclaw doctor
781-
openclaw gateway restart
776+
openclaw update --channel dev
782777
```
783778

784779
From git to npm:
785780

786781
```bash
787-
npm install -g openclaw@latest
788-
openclaw doctor
789-
openclaw gateway restart
782+
openclaw update --channel stable
790783
```
791784

792-
Doctor detects a gateway service entrypoint mismatch and offers to rewrite the service config to match the current install (use `--repair` in automation).
785+
Add `--dry-run` to preview the planned mode switch first. The updater runs
786+
Doctor follow-ups, refreshes plugin sources for the target channel, and
787+
restarts the gateway unless you pass `--no-restart`.
788+
789+
The installer can force either mode too:
790+
791+
```bash
792+
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method git
793+
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --install-method npm
794+
```
793795

794796
Backup tips: see [Backup strategy](#where-things-live-on-disk).
795797

‎docs/install/index.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ curl -fsSL https://openclaw.ai/install-cli.sh | bash
6161
It supports npm installs by default, plus git-checkout installs under the same
6262
prefix flow. Full reference: [Installer internals](/install/installer#install-clish).
6363

64+
Already installed? Switch between package and git installs with
65+
`openclaw update --channel dev` and `openclaw update --channel stable`. See
66+
[Updating](/install/updating#switch-between-npm-and-git-installs).
67+
6468
### npm, pnpm, or bun
6569

6670
If you already manage Node yourself:

‎docs/install/updating.md‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ To switch channels or target a specific version:
2020

2121
```bash
2222
openclaw update --channel beta
23+
openclaw update --channel dev
2324
openclaw update --tag main
2425
openclaw update --dry-run # preview without applying
2526
```
@@ -30,13 +31,41 @@ if you want the raw npm beta dist-tag for a one-off package update.
3031

3132
See [Development channels](/install/development-channels) for channel semantics.
3233

34+
## Switch between npm and git installs
35+
36+
Use channels when you want to change the install type. The updater keeps your
37+
state, config, credentials, and workspace in `~/.openclaw`; it only changes
38+
which OpenClaw code install the CLI and gateway use.
39+
40+
```bash
41+
# npm package install -> editable git checkout
42+
openclaw update --channel dev
43+
44+
# git checkout -> npm package install
45+
openclaw update --channel stable
46+
```
47+
48+
Run with `--dry-run` first to preview the exact install-mode switch:
49+
50+
```bash
51+
openclaw update --channel dev --dry-run
52+
openclaw update --channel stable --dry-run
53+
```
54+
55+
The `dev` channel ensures a git checkout, builds it, and installs the global CLI
56+
from that checkout. The `stable` and `beta` channels use package installs. If the
57+
gateway is already installed, `openclaw update` refreshes the service metadata
58+
and restarts it unless you pass `--no-restart`.
59+
3360
## Alternative: re-run the installer
3461

3562
```bash
3663
curl -fsSL https://openclaw.ai/install.sh | bash
3764
```
3865

39-
Add `--no-onboard` to skip onboarding. For source installs, pass `--install-method git --no-onboard`.
66+
Add `--no-onboard` to skip onboarding. To force a specific install type through
67+
the installer, pass `--install-method git --no-onboard` or
68+
`--install-method npm --no-onboard`.
4069

4170
## Alternative: manual npm, pnpm, or bun
4271

‎scripts/install.ps1‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Or: & ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
44

55
param(
6+
[ValidateSet("npm", "git")]
67
[string]$InstallMethod = "npm",
78
[string]$Tag = "latest",
89
[string]$GitDir = "$env:USERPROFILE\openclaw",
@@ -336,11 +337,13 @@ function Install-OpenClawGit {
336337
if (!(Test-Path $wrapperDir)) {
337338
New-Item -ItemType Directory -Path $wrapperDir -Force | Out-Null
338339
}
339-
340+
341+
$entryPath = Join-Path $RepoDir "dist\entry.js"
340342
@"
341343
@echo off
342-
node "%~dp0..\openclaw\dist\entry.js" %*
344+
node "$entryPath" %*
343345
"@ | Out-File -FilePath "$wrapperDir\openclaw.cmd" -Encoding ASCII -Force
346+
Add-ToPath -Path $wrapperDir
344347

345348
Write-Host "OpenClaw installed" -Level success
346349
return $true
@@ -432,7 +435,12 @@ function Main {
432435
if ($DryRun) {
433436
Write-Host "[DRY RUN] Would install OpenClaw from git to $GitDir" -Level info
434437
} else {
435-
Install-OpenClawGit -RepoDir $GitDir -Update:(-not $NoGitUpdate)
438+
try {
439+
npm uninstall -g openclaw 2>$null | Out-Null
440+
} catch { }
441+
if (!(Install-OpenClawGit -RepoDir $GitDir -Update:(-not $NoGitUpdate))) {
442+
return (Fail-Install)
443+
}
436444
}
437445
} else {
438446
# npm method
@@ -443,6 +451,11 @@ function Main {
443451
if ($DryRun) {
444452
Write-Host "[DRY RUN] Would install OpenClaw via npm ($((Resolve-PackageInstallSpec -Target $Tag)))" -Level info
445453
} else {
454+
$gitWrapper = "$env:USERPROFILE\.local\bin\openclaw.cmd"
455+
if (Test-Path $gitWrapper) {
456+
Remove-Item -Force $gitWrapper
457+
Write-Host "Removed git wrapper (switching to npm)" -Level info
458+
}
446459
if (!(Install-OpenClawNpm -Target $Tag)) {
447460
return (Fail-Install)
448461
}

‎scripts/install.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,7 @@ main() {
26672667
ui_section "Source install details"
26682668
ui_kv "Checkout" "$final_git_dir"
26692669
ui_kv "Wrapper" "$HOME/.local/bin/openclaw"
2670-
ui_kv "Update command" "openclaw update --restart"
2670+
ui_kv "Update command" "openclaw update"
26712671
ui_kv "Switch to npm" "curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method npm"
26722672
elif [[ "$is_upgrade" == "true" ]]; then
26732673
ui_info "Upgrade complete"

‎src/cli/update-cli.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ${theme.heading("Switch channels:")}
7575
7676
${theme.heading("Non-interactive:")}
7777
- Use --yes to accept downgrade prompts
78-
- Combine with --channel/--tag/--restart/--json/--timeout as needed
78+
- Combine with --channel/--tag/--no-restart/--json/--timeout as needed
7979
- Use --dry-run to preview actions without writing config/installing/restarting
8080
8181
${theme.heading("Examples:")}

0 commit comments

Comments
 (0)