Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs: replace bare pm2 commands with bundled-friendly forms (#10397)

Adam Eivy077427e4a60b
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index a645fe13dc..2779b5db05 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -69,7 +69,7 @@ lsof -i :5555
**Solution**:
```bash
# Check PM2 logs for errors
-pm2 logs portos-server --lines 100
+npm run pm2:logs -- portos-server --lines 100
# Common causes:
# - Missing dependencies: npm run install:all
@@ -116,7 +116,7 @@ netstat -an | grep 5555
**Solution**:
- Check browser console for WebSocket errors
-- Verify server is running: `pm2 status`
+- Verify server is running: `npm run pm2:status`
- Restart server: `npm run pm2:restart`
## Browser Console Warnings
@@ -273,10 +273,10 @@ daemon default (`OLLAMA_CONTEXT_LENGTH`).
**Solution**:
```bash
# Check CoS runner is running
-pm2 status | grep portos-cos
+npm run pm2:status | grep portos-cos
# Check runner logs
-pm2 logs portos-cos --lines 100
+npm run pm2:logs -- portos-cos --lines 100
# Verify Claude CLI is available
which claude
@@ -304,7 +304,7 @@ see `server/lib/ptySpawnDiagnostics.js`.
# In the PRIMARY checkout, never in a worktree
npm install --prefix server
npm install --prefix client
-pm2 restart portos-cos
+npx pm2 restart portos-cos
```
**Prevention**: ordinary CoS worktrees share dependencies through symlinks, so
@@ -381,6 +381,8 @@ For anywhere else, set `PORTOS_WORKSPACE_ROOTS`. Separate entries with `;` on Wi
## PM2 Issues
+All PM2 commands below use the bundled copy at `node ./node_modules/pm2/bin/pm2`, accessed through npm scripts (`npm run pm2:*`) or `npx pm2 …`. A globally installed `pm2` works too, but these forms need nothing beyond `npm run setup`.
+
### Process Keeps Restarting
**Symptom**: PM2 shows high restart count, app unstable.
@@ -388,7 +390,7 @@ For anywhere else, set `PORTOS_WORKSPACE_ROOTS`. Separate entries with `;` on Wi
**Solution**:
```bash
# Check for crash reason
-pm2 logs portos-server --lines 200
+npm run pm2:logs -- portos-server --lines 200
# Common causes:
# - Unhandled exceptions (check error handling)
@@ -398,16 +400,16 @@ pm2 logs portos-server --lines 200
### Cannot Stop Processes
-**Symptom**: `pm2 stop` doesn't work or processes restart.
+**Symptom**: `npm run pm2:stop` doesn't work or processes restart.
**Solution**:
```bash
-# Stop specific ecosystem
-pm2 stop ecosystem.config.cjs
+# Stop specific ecosystem (scoped to PortOS's apps)
+npm run pm2:stop
# Never use these (affects all PM2 apps):
-# pm2 kill ← Don't use
-# pm2 delete all ← Don't use
+# npx pm2 kill ← Don't use
+# npx pm2 delete all ← Don't use
```
### Old Code Running After Changes
@@ -503,7 +505,7 @@ cat data/apps.json | jq .
### Slow UI Loading
**Causes and Solutions**:
-1. **Large log files**: Clear old logs with `pm2 flush`
+1. **Large log files**: Clear PortOS logs with `npx pm2 flush portos-server` (or `npx pm2 flush portos-cos`, etc.). Never use bare `npx pm2 flush`, which also clears every other app's logs.
2. **Many apps**: Pagination added in recent versions
3. **Network latency**: Use local access when possible
@@ -512,7 +514,7 @@ cat data/apps.json | jq .
**Solution**:
```bash
# Check PM2 memory usage
-pm2 monit
+npx pm2 monit
# Set memory limits in ecosystem.config.cjs
max_memory_restart: '500M'
@@ -569,7 +571,7 @@ git submodule update --init --recursive
**Symptom**: Frontend changes require manual refresh.
**Solution**:
-- Check Vite is running: `pm2 logs portos-ui`
+- Check Vite is running: `npm run pm2:logs -- portos-ui`
- Ensure file watchers aren't exhausted: `fs.inotify.max_user_watches`
### Tests Failing
@@ -884,7 +886,7 @@ a test, and update macOS + `mflux`/`mlx`.
## Getting Help
-1. **Check logs**: `pm2 logs` shows all process output
+1. **Check logs**: `npm run pm2:logs` shows all PortOS process output
2. **Browser console**: F12 → Console for frontend errors
3. **Server logs**: Look for emoji prefixes (❌ errors, ⚠️ warnings)
4. **GitHub Issues**: Report bugs at https://github.com/atomantic/PortOS/issues