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

Use POSIX paths for the nvm and boot-script checks

Claude1a0b93d92ec6
diff --git a/server/services/nodeRuntime.js b/server/services/nodeRuntime.js
index cf1f181e85..f7c157d735 100644
--- a/server/services/nodeRuntime.js
+++ b/server/services/nodeRuntime.js
@@ -25,7 +25,8 @@
import { existsSync, readdirSync, readFileSync } from 'fs';
import { homedir, userInfo } from 'os';
-import { dirname, join } from 'path';
+// nvm, launchd and systemd paths are POSIX-only; Windows never reaches an update.
+import { posix } from 'path';
import { ServerError } from '../lib/errorHandler.js';
import { PATHS, atomicWrite } from '../lib/fileUtils.js';
import { runStreamingCommand } from '../lib/streamingSpawn.js';
@@ -43,6 +44,7 @@ import {
} from '../../scripts/checkNodeVersion.js';
const IS_WIN = process.platform === 'win32';
+const { dirname, join } = posix;
const VERSION_RE = /^v\d+\.\d+\.\d+$/;
const NODE_INDEX_URL = 'https://nodejs.org/dist/index.json';
const PM2_LATEST_URL = 'https://registry.npmjs.org/pm2/latest';
diff --git a/server/services/nodeRuntime.test.js b/server/services/nodeRuntime.test.js
index 21140a0c86..f8e2c35ab7 100644
--- a/server/services/nodeRuntime.test.js
+++ b/server/services/nodeRuntime.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
-import { join } from 'path';
+import { posix } from 'path';
import { __testing } from './nodeRuntime.js';
const { getStartupStatus, resolveNvm, rewriteLaunchAgent, summarizeNodeReleases } = __testing;
@@ -67,11 +67,11 @@ describe('getStartupStatus', () => {
it('flags a boot script that still launches an older Node and gives the sudo command', () => {
const status = getStartupStatus({
nodeBinary, platform: 'darwin', home: '/Users/example', user: 'example',
- readText: (file) => (file === join('/Users/example', 'Library', 'LaunchAgents', 'pm2.example.plist')
+ readText: (file) => (file === posix.join('/Users/example', 'Library', 'LaunchAgents', 'pm2.example.plist')
? '<string>/Users/example/.nvm/versions/node/v24.14.1/bin</string>' : null),
});
expect(status).toMatchObject({ system: 'launchd', configured: true, current: false, fixable: true });
- expect(status.command).toBe(`sudo env PATH=$PATH:${binDir} ${join(binDir, 'pm2')} startup launchd -u example --hp /Users/example`);
+ expect(status.command).toBe(`sudo env PATH=$PATH:${binDir} ${posix.join(binDir, 'pm2')} startup launchd -u example --hp /Users/example`);
});
it('repoints every nvm Node path in a LaunchAgent, and refuses what it cannot safely rewrite', () => {
diff --git a/server/services/nodeRuntime.update.test.js b/server/services/nodeRuntime.update.test.js
index 1343c3109f..9f85a1c9c5 100644
--- a/server/services/nodeRuntime.update.test.js
+++ b/server/services/nodeRuntime.update.test.js
@@ -73,7 +73,13 @@ afterEach(() => {
afterAll(() => rmSync(TMP, { recursive: true, force: true }));
-describe('startNodeUpdate', () => {
+// nvm does not exist on Windows; there the update is refused up front.
+it.runIf(process.platform === 'win32')('refuses to update Node on Windows', async () => {
+ await expect(startNodeUpdate({ version: NEXT, io })).rejects.toMatchObject({ code: 'NODE_UPDATE_UNAVAILABLE' });
+ expect(mocks.runStreamingCommand).not.toHaveBeenCalled();
+});
+
+describe.skipIf(process.platform === 'win32')('startNodeUpdate', () => {
it('installs with nvm, pins PortOS to the new binary and launches the restart', async () => {
await expect(startNodeUpdate({ version: NEXT, io })).resolves.toEqual({ started: true, restart: true });
await vi.waitFor(() => expect(mocks.startPortosSelfUpdate).toHaveBeenCalled());