Skip to content

Commit 7db97f3

Browse files
committed
Add Windows Server Node.js installation guide
1 parent d132b41 commit 7db97f3

1 file changed

Lines changed: 126 additions & 0 deletions

File tree

INSTALL_WINDOWS_NODEJS.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# OpenCode Installation for Windows Server 2022 (Node.js)
2+
3+
This guide will help you install and run OpenCode with Node.js on Windows Server 2022, avoiding the Bun virtualization issues.
4+
5+
## Prerequisites
6+
7+
1. **Node.js 20+** must be installed
8+
2. **Git** must be installed
9+
3. PowerShell with Administrator access
10+
11+
## Installation Steps
12+
13+
### 1. Clone the Node.js Migration Branch
14+
15+
```powershell
16+
# Clone the repository and checkout the node-migration branch
17+
git clone https://github.com/mattbaylor/opencode.git
18+
cd opencode
19+
git checkout node-migration
20+
```
21+
22+
### 2. Install pnpm
23+
24+
```powershell
25+
npm install -g pnpm
26+
```
27+
28+
### 3. Install Dependencies
29+
30+
```powershell
31+
pnpm install
32+
```
33+
34+
This will install all dependencies for the monorepo.
35+
36+
### 4. Run OpenCode
37+
38+
```powershell
39+
# Navigate to opencode package
40+
cd packages\opencode
41+
42+
# Run with tsx (TypeScript executor)
43+
npx tsx src\index.ts
44+
45+
# Or run from root with pnpm
46+
cd ..\..
47+
pnpm --filter opencode exec tsx src/index.ts
48+
```
49+
50+
## Creating a Convenient Launcher
51+
52+
### Option 1: PowerShell Function
53+
54+
Add this to your PowerShell profile (`notepad $PROFILE`):
55+
56+
```powershell
57+
function opencode {
58+
$OpencodeDir = "C:\path\to\opencode" # Update this path
59+
Push-Location "$OpencodeDir\packages\opencode"
60+
npx tsx src\index.ts $args
61+
Pop-Location
62+
}
63+
```
64+
65+
Then reload your profile: `. $PROFILE`
66+
67+
Now you can run `opencode` from anywhere!
68+
69+
### Option 2: Batch File
70+
71+
Create `C:\Windows\opencode.bat`:
72+
73+
```batch
74+
@echo off
75+
cd /d C:\path\to\opencode\packages\opencode
76+
npx tsx src\index.ts %*
77+
```
78+
79+
Make sure `C:\Windows` is in your PATH (it usually is).
80+
81+
## Troubleshooting
82+
83+
### If `pnpm install` fails
84+
85+
Make sure you're on the `node-migration` branch:
86+
```powershell
87+
git branch
88+
```
89+
90+
Should show `* node-migration`
91+
92+
### If dependencies fail to install
93+
94+
Try clearing the cache:
95+
```powershell
96+
pnpm store prune
97+
pnpm install --force
98+
```
99+
100+
### If tsx command not found
101+
102+
Install it globally:
103+
```powershell
104+
npm install -g tsx
105+
```
106+
107+
## Why This Works
108+
109+
- **No Bun dependency**: Completely runs on Node.js
110+
- **No VM issues**: Node.js doesn't have the memory alignment bugs that Bun has in VMs
111+
- **No AVX2 requirement**: Node.js works fine without AVX2 instructions
112+
- **Easy to update**: Just `git pull` and `pnpm install`
113+
114+
## Next Steps
115+
116+
Once you verify it works, you can:
117+
1. Update to latest changes: `git pull origin node-migration`
118+
2. Rebuild if needed: `pnpm install`
119+
3. Customize your configuration in `~/.opencode/`
120+
121+
## Support
122+
123+
The Windows binaries are available at:
124+
https://github.com/mattbaylor/opencode/releases/tag/windows-baseline-build
125+
126+
(Note: These are Bun-based and will crash in VMs - use this Node.js method instead)

0 commit comments

Comments
 (0)