Skip to content

Commit dafa342

Browse files
authored
Added WINDOWS_SETUP.md
1 parent b1ee91f commit dafa342

File tree

4 files changed

+394
-23
lines changed

4 files changed

+394
-23
lines changed

WINDOWS_SETUP.md

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
# Windows Setup Guide
2+
3+
## Quick Fix for "EPERM: operation not permitted" Error
4+
5+
If you see an error like:
6+
```
7+
Error: EPERM: operation not permitted, mkdir 'C:\Windows\System32\node_modules\.vite\deps_temp_...'
8+
```
9+
10+
**This means you're running the command from the wrong directory!**
11+
12+
### Solution
13+
14+
1. **Open Command Prompt or PowerShell**
15+
2. **Navigate to the project directory**:
16+
```cmd
17+
cd path\to\local-nexus-controller
18+
```
19+
3. **Run the startup script**:
20+
```cmd
21+
start.bat
22+
```
23+
24+
OR use npm:
25+
```cmd
26+
npm run dev
27+
```
28+
29+
---
30+
31+
## Recommended Startup Methods for Windows
32+
33+
### Method 1: Use the Batch File (Easiest)
34+
35+
Double-click `start.bat` in the project folder, or run:
36+
```cmd
37+
start.bat
38+
```
39+
40+
**Benefits:**
41+
- Automatically changes to correct directory
42+
- Checks Python installation
43+
- Shows clear error messages
44+
- Handles dependency installation
45+
46+
### Method 2: Use npm from Project Directory
47+
48+
1. Open Command Prompt or PowerShell
49+
2. Navigate to project:
50+
```cmd
51+
cd C:\path\to\local-nexus-controller
52+
```
53+
3. Run:
54+
```cmd
55+
npm run dev
56+
```
57+
58+
### Method 3: Direct Python Command
59+
60+
```cmd
61+
cd C:\path\to\local-nexus-controller
62+
python -m local_nexus_controller
63+
```
64+
65+
---
66+
67+
## Common Windows Issues
68+
69+
### Issue 1: Running from System32
70+
71+
**Problem:** Command Prompt opens in `C:\Windows\System32` by default
72+
73+
**Symptoms:**
74+
- Vite errors about System32 directories
75+
- "EPERM: operation not permitted"
76+
- Can't find project files
77+
78+
**Solution:**
79+
1. Always `cd` to your project directory first
80+
2. Or use the `start.bat` script which does this automatically
81+
82+
### Issue 2: Python Not Found
83+
84+
**Problem:** `python` command not recognized
85+
86+
**Solutions:**
87+
88+
A. **Check if Python is installed:**
89+
```cmd
90+
python --version
91+
```
92+
93+
If not found, install from: https://www.python.org/downloads/
94+
95+
B. **Use `py` launcher instead:**
96+
```cmd
97+
py --version
98+
py -m local_nexus_controller
99+
```
100+
101+
C. **Add Python to PATH:**
102+
- Reinstall Python
103+
- Check "Add Python to PATH" during installation
104+
105+
### Issue 3: pip Not Available
106+
107+
**Problem:** `pip` command not working
108+
109+
**Solutions:**
110+
111+
Try these in order:
112+
```cmd
113+
pip install -r requirements.txt
114+
python -m pip install -r requirements.txt
115+
py -m pip install -r requirements.txt
116+
pip3 install -r requirements.txt
117+
```
118+
119+
The application will try all of these automatically!
120+
121+
### Issue 4: Permission Errors During Install
122+
123+
**Problem:** "Access is denied" when installing packages
124+
125+
**Solutions:**
126+
127+
A. **Use --user flag:**
128+
```cmd
129+
pip install --user -r requirements.txt
130+
```
131+
132+
B. **Run as Administrator:**
133+
- Right-click Command Prompt
134+
- Select "Run as administrator"
135+
- Navigate to project and run commands
136+
137+
C. **Use a virtual environment:**
138+
```cmd
139+
python -m venv venv
140+
venv\Scripts\activate
141+
pip install -r requirements.txt
142+
python -m local_nexus_controller
143+
```
144+
145+
---
146+
147+
## Recommended Setup for Windows
148+
149+
### One-Time Setup
150+
151+
1. **Install Python 3.10 or higher**
152+
- Download from https://www.python.org/downloads/
153+
- CHECK "Add Python to PATH" during installation
154+
155+
2. **Open PowerShell or Command Prompt**
156+
157+
3. **Navigate to project:**
158+
```cmd
159+
cd C:\path\to\local-nexus-controller
160+
```
161+
162+
4. **Install dependencies** (optional, auto-installs on first run):
163+
```cmd
164+
pip install -r requirements.txt
165+
```
166+
167+
### Daily Use
168+
169+
Just double-click `start.bat` or run:
170+
```cmd
171+
npm run dev
172+
```
173+
174+
---
175+
176+
## Understanding the Vite Error
177+
178+
**Why does Vite show up in the errors?**
179+
180+
The Vite error in your screenshot is a red herring. It's happening because:
181+
182+
1. Your terminal was in the `C:\Windows\System32` directory
183+
2. Some process (possibly the Bolt.new IDE) was trying to start
184+
3. It tried to write temp files to System32 (not allowed)
185+
186+
**Local Nexus Controller doesn't use Vite.** It's a Python/FastAPI application with simple HTML templates.
187+
188+
The fix is to ensure you're running commands from the project directory, not System32.
189+
190+
---
191+
192+
## Verification Steps
193+
194+
After setup, verify everything works:
195+
196+
### 1. Check Python
197+
```cmd
198+
python --version
199+
```
200+
Should show: Python 3.10.0 or higher
201+
202+
### 2. Check Project Files
203+
```cmd
204+
dir
205+
```
206+
Should show: `app.py`, `requirements.txt`, `local_nexus_controller` folder
207+
208+
### 3. Test Import
209+
```cmd
210+
python -c "import sys; print(sys.executable)"
211+
```
212+
Should show path to your Python installation
213+
214+
### 4. Run Application
215+
```cmd
216+
start.bat
217+
```
218+
Or:
219+
```cmd
220+
npm run dev
221+
```
222+
223+
Should see:
224+
```
225+
INFO: Uvicorn running on http://0.0.0.0:5010
226+
```
227+
228+
### 5. Open Browser
229+
Visit: http://localhost:5010
230+
231+
You should see the Local Nexus Controller dashboard!
232+
233+
---
234+
235+
## PowerShell Execution Policy
236+
237+
If you get "execution policy" errors in PowerShell:
238+
239+
```powershell
240+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
241+
```
242+
243+
Then try running again.
244+
245+
---
246+
247+
## Environment Variables
248+
249+
The application uses these environment variables (optional):
250+
251+
```env
252+
LOCAL_NEXUS_PORT=5010
253+
LOCAL_NEXUS_HOST=0.0.0.0
254+
LOCAL_NEXUS_OPEN_BROWSER=true
255+
LOCAL_NEXUS_RELOAD=true
256+
```
257+
258+
Create a `.env` file in the project root to customize these.
259+
260+
---
261+
262+
## Still Having Issues?
263+
264+
1. **Check you're in the correct directory:**
265+
```cmd
266+
cd
267+
```
268+
Should show your project path, not System32
269+
270+
2. **Try the batch file:**
271+
```cmd
272+
start.bat
273+
```
274+
275+
3. **Check the full error message** and see which method failed
276+
277+
4. **Manual installation:**
278+
```cmd
279+
cd C:\path\to\local-nexus-controller
280+
pip install fastapi uvicorn sqlmodel jinja2 python-dotenv psutil
281+
python -m local_nexus_controller
282+
```
283+
284+
5. **Check Python path:**
285+
```cmd
286+
where python
287+
```
288+
289+
If all else fails, try using a Python virtual environment (see Issue 4 above).
290+
291+
---
292+
293+
## Success Indicators
294+
295+
When everything works, you'll see:
296+
297+
```
298+
INFO: Will watch for changes in these directories: [...]
299+
INFO: Uvicorn running on http://0.0.0.0:5010 (Press CTRL+C to quit)
300+
INFO: Started reloader process [...]
301+
INFO: Started server process [...]
302+
INFO: Waiting for application startup.
303+
INFO: Application startup complete.
304+
```
305+
306+
Then open http://localhost:5010 in your browser!

local_nexus_controller/__main__.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,34 @@
1313
print("uvicorn is not installed. Installing dependencies...")
1414
print()
1515

16-
try:
17-
subprocess.check_call([
18-
sys.executable, "-m", "pip", "install",
19-
"--break-system-packages", "-r", "requirements.txt"
20-
], stderr=subprocess.STDOUT)
21-
print("\n✓ Dependencies installed successfully")
22-
print("Please restart the application.\n")
23-
except subprocess.CalledProcessError:
16+
installation_methods = [
17+
(["pip3", "install", "-r", "requirements.txt"], "pip3 install"),
18+
(["pip", "install", "-r", "requirements.txt"], "pip install"),
19+
([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], "python -m pip"),
20+
(["pip3", "install", "--user", "-r", "requirements.txt"], "pip3 install --user"),
21+
(["pip", "install", "--user", "-r", "requirements.txt"], "pip install --user"),
22+
]
23+
24+
success = False
25+
for cmd, desc in installation_methods:
2426
try:
25-
subprocess.check_call([
26-
sys.executable, "-m", "pip", "install",
27-
"--user", "-r", "requirements.txt"
28-
], stderr=subprocess.STDOUT)
29-
print("\n✓ Dependencies installed successfully")
27+
print(f"Trying: {desc}...")
28+
subprocess.check_call(cmd, stderr=subprocess.STDOUT)
29+
print(f"\n✓ Dependencies installed successfully using {desc}")
3030
print("Please restart the application.\n")
31-
except subprocess.CalledProcessError as e:
32-
print("\n✗ Failed to install dependencies")
33-
print(f"Error: {e}")
34-
print("\nPlease install manually:")
35-
print(f" {sys.executable} -m pip install -r requirements.txt")
36-
print()
37-
sys.exit(1)
31+
success = True
32+
break
33+
except (subprocess.CalledProcessError, FileNotFoundError):
34+
continue
35+
36+
if not success:
37+
print("\n✗ Failed to install dependencies using all methods")
38+
print("\nPlease install manually using one of these commands:")
39+
print(" pip install -r requirements.txt")
40+
print(" pip3 install -r requirements.txt")
41+
print(f" {sys.executable} -m pip install -r requirements.txt")
42+
print()
43+
sys.exit(1)
3844

3945
sys.exit(0)
4046

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
"version": "0.1.0",
44
"description": "Local service controller and dashboard",
55
"scripts": {
6-
"postinstall": "python3 -m pip install --break-system-packages -r requirements.txt 2>/dev/null || python3 -m pip install --user -r requirements.txt 2>/dev/null || pip3 install --break-system-packages -r requirements.txt 2>/dev/null || pip3 install --user -r requirements.txt 2>/dev/null || echo 'Note: Python dependencies will be installed on first run'",
7-
"predev": "python3 -c 'import uvicorn' 2>/dev/null || python3 -m pip install --break-system-packages -r requirements.txt || python3 -m pip install --user -r requirements.txt",
86
"dev": "python3 -m local_nexus_controller",
97
"start": "python3 -m local_nexus_controller",
10-
"build": "python3 -m pip install --break-system-packages -r requirements.txt 2>/dev/null || python3 -m pip install --user -r requirements.txt 2>/dev/null || echo 'Dependencies check' && python3 -c 'from local_nexus_controller.main import app; print(\"✓ Application ready\")'"
8+
"build": "echo 'Python project - dependencies managed by application'"
119
}
1210
}

0 commit comments

Comments
 (0)