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

address review: OS-agnostic paths, port retry logic to update.ps1

[._.]/ Adam Eivy65a9bdeefbd0
diff --git a/package.json b/package.json
index 2b16804c41..243978ef4a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "1.27.3",
+ "version": "1.27.4",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",
diff --git a/scripts/ensure-deps.js b/scripts/ensure-deps.js
index 74f234b450..d9cc04898b 100644
--- a/scripts/ensure-deps.js
+++ b/scripts/ensure-deps.js
@@ -64,14 +64,14 @@ for (const { dir, label, pkg } of criticalPackages) {
}
for (const [dir, { label, pkgs }] of criticalByDir) {
- const missing = pkgs.filter(pkg => !existsSync(join(dir, 'node_modules', pkg)));
+ const missing = pkgs.filter(pkg => !existsSync(join(dir, 'node_modules', ...pkg.split('/'))));
if (!missing.length) continue;
console.log(`📦 Missing ${missing.map(p => p.split('/')[0]).join(', ')} in ${label} — reinstalling deps...`);
if (!install(dir, label)) process.exit(1);
needed = true;
- const stillMissing = pkgs.filter(pkg => !existsSync(join(dir, 'node_modules', pkg)));
+ const stillMissing = pkgs.filter(pkg => !existsSync(join(dir, 'node_modules', ...pkg.split('/'))));
if (stillMissing.length) {
console.error(`❌ Still missing in ${label} after reinstall: ${stillMissing.map(p => p.split('/')[0]).join(', ')}`);
process.exit(1);
diff --git a/update.ps1 b/update.ps1
index b97d62e457..97e3626bd9 100644
--- a/update.ps1
+++ b/update.ps1
@@ -6,6 +6,29 @@ Write-Host " PortOS Update" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
Write-Host ""
+# Resilient npm install — retries once after cleaning node_modules on failure
+function Safe-Install {
+ param([string]$Dir = ".", [string]$Label = "root")
+
+ Write-Host "📦 Installing deps ($Label)..." -ForegroundColor Yellow
+ Push-Location $Dir
+ npm install 2>&1
+ if ($LASTEXITCODE -eq 0) { Pop-Location; return }
+
+ Write-Host "⚠️ npm install failed for $Label — cleaning node_modules and retrying..." -ForegroundColor Yellow
+ Pop-Location
+ if (Test-Path "$Dir/node_modules") {
+ Remove-Item -Recurse -Force "$Dir/node_modules" -ErrorAction SilentlyContinue
+ }
+ Push-Location $Dir
+ npm install 2>&1
+ if ($LASTEXITCODE -eq 0) { Pop-Location; return }
+
+ Pop-Location
+ Write-Host "❌ npm install failed for $Label after retry" -ForegroundColor Red
+ exit 1
+}
+
# Pull latest
Write-Host "Pulling latest changes..." -ForegroundColor Yellow
git pull --rebase --autostash
@@ -17,26 +40,20 @@ Write-Host "Stopping PortOS apps..." -ForegroundColor Yellow
npm run pm2:stop 2>$null
Write-Host ""
-# Update dependencies
+# Update dependencies with retry logic
Write-Host "Updating dependencies..." -ForegroundColor Yellow
-
-Write-Host " Installing root dependencies..."
-npm install
-if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-
-Write-Host " Installing client dependencies..."
-Push-Location client
-npm install
-if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
-Pop-Location
-
-Write-Host " Installing server dependencies..."
-Push-Location server
-npm install
-if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
-Pop-Location
+Safe-Install -Dir "." -Label "root"
+Safe-Install -Dir "client" -Label "client"
+Safe-Install -Dir "server" -Label "server"
Write-Host ""
+# Verify critical dependencies exist
+if (-not (Test-Path "client/node_modules/vite/bin/vite.js")) {
+ Write-Host "❌ Critical dependency missing: client/node_modules/vite" -ForegroundColor Red
+ Write-Host " Try running: npm run install:all"
+ exit 1
+}
+
# Run setup (data dirs + browser deps)
Write-Host "Ensuring data & browser setup..." -ForegroundColor Yellow
npm run setup
@@ -54,6 +71,6 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host ""
Write-Host "===================================" -ForegroundColor Green
-Write-Host " Update Complete!" -ForegroundColor Green
+Write-Host " ✅ Update Complete!" -ForegroundColor Green
Write-Host "===================================" -ForegroundColor Green
Write-Host ""