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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: resolve PM2 binary path for status queries and dev mode startup
[._.]/ Adam Eivy2f91cfa68afb
diff --git a/.changelog/v1.6.x.md b/.changelog/v1.6.x.mdindex fb878feb36..451aebaac3 100644--- a/.changelog/v1.6.x.md+++ b/.changelog/v1.6.x.md@@ -28,6 +28,17 @@ Folder picker improvements for Windows: drive selector, home directory quick-nav- Eliminated remaining CMD window flashes by bypassing `pm2.cmd` entirely: all PM2 CLI invocations (`jlist`, `logs`, `start`, `stop`, `restart`, `delete`) now run `node pm2/bin/pm2` directly instead of `spawn('pm2', {shell:true})` which created a `cmd.exe → pm2.cmd → node` chain where the intermediate `.cmd` batch file flashed a visible window. New `spawnPm2()` and `execPm2()` helpers in `pm2.js` are shared by logs, socket, detect, streamingDetect, and cos services.- Updated all `pm2:*` npm scripts in package.json to use `node ./node_modules/pm2/bin/pm2` instead of bare `pm2` command, avoiding `pm2.cmd` batch file wrapper on Windows+### PM2 binary resolution fails when pm2 not globally installed+- `spawnPm2()` on macOS/Linux fell back to `spawn('pm2', ...)` which requires a global pm2 install — now always uses `node pm2/bin/pm2` via the local binary on all platforms+- Fixed `PM2_BIN` path using `require.resolve('pm2/package.json')` instead of a hardcoded relative path that broke when pm2 was hoisted to the root `node_modules`+- This caused all app status queries to silently fail, making every app appear "Offline"++### `npm run dev` uses PM2 instead of concurrently+- Changed `npm run dev` to `pm2 start ecosystem.config.cjs && pm2 logs` so dev mode uses the same PM2 process management as production+- Enabled file watching on `portos-server` for automatic restart on code changes+- Fixed Vite binary path in ecosystem config (`client/node_modules/vite` → `node_modules/vite`) since vite is hoisted to root+- Removed unused `concurrently` devDependency+### FolderPicker: Error state handling- Directory load errors now display inline with a message and "Go to default directory" recovery button instead of silently failing- Select button is disabled when no path is loadeddiff --git a/ecosystem.config.cjs b/ecosystem.config.cjsindex 3a74583da5..158d1421e8 100644--- a/ecosystem.config.cjs+++ b/ecosystem.config.cjs@@ -37,7 +37,8 @@ module.exports = {PORT: PORTS.API,HOST: '0.0.0.0'},- watch: false,+ watch: ['server'],+ ignore_watch: ['node_modules', '*.test.js'],max_memory_restart: '500M'},{@@ -67,7 +68,7 @@ module.exports = {},{name: 'portos-ui',- script: path.join(__dirname, 'client', 'node_modules', 'vite', 'bin', 'vite.js'),+ script: path.join(__dirname, 'node_modules', 'vite', 'bin', 'vite.js'),cwd: path.join(__dirname, 'client'),log_date_format: LOG_DATE_FORMAT,windowsHide: IS_WIN,diff --git a/package-lock.json b/package-lock.jsonindex 2db8f6b232..0ede278d37 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "portos",- "version": "1.6.3",+ "version": "1.6.4","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "portos",- "version": "1.6.3",+ "version": "1.6.4","license": "MIT","dependencies": {"express": "^4.21.2",@@ -15,7 +15,6 @@"devDependencies": {"@vitejs/plugin-react": "^4.3.4","autoprefixer": "^10.4.20",- "concurrently": "^8.2.2","pm2": "^5.4.3","postcss": "^8.4.49","tailwindcss": "^3.4.17",@@ -24,7 +23,7 @@},"client": {"name": "portos-client",- "version": "1.1.2",+ "version": "1.5.0","extraneous": true,"dependencies": {"@dnd-kit/core": "^6.3.1",@@ -301,16 +300,6 @@"@babel/core": "^7.0.0-0"}},- "node_modules/@babel/runtime": {- "version": "7.28.4",- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz",- "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=6.9.0"- }- },"node_modules/@babel/template": {"version": "7.27.2","resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",@@ -1676,16 +1665,6 @@"node": ">=6"}},- "node_modules/ansi-regex": {- "version": "5.0.1",- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=8"- }- },"node_modules/ansi-styles": {"version": "4.3.0","resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",@@ -2026,36 +2005,6 @@],"license": "CC-BY-4.0"},- "node_modules/chalk": {- "version": "4.1.2",- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",- "dev": true,- "license": "MIT",- "dependencies": {- "ansi-styles": "^4.1.0",- "supports-color": "^7.1.0"- },- "engines": {- "node": ">=10"- },- "funding": {- "url": "https://github.com/chalk/chalk?sponsor=1"- }- },- "node_modules/chalk/node_modules/supports-color": {- "version": "7.2.0",- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",- "dev": true,- "license": "MIT",- "dependencies": {- "has-flag": "^4.0.0"- },- "engines": {- "node": ">=8"- }- },"node_modules/charm": {"version": "0.1.2","resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz",@@ -2127,21 +2076,6 @@"node": ">=8"}},- "node_modules/cliui": {- "version": "8.0.1",- "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",- "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",- "dev": true,- "license": "ISC",- "dependencies": {- "string-width": "^4.2.0",- "strip-ansi": "^6.0.1",- "wrap-ansi": "^7.0.0"- },- "engines": {- "node": ">=12"- }- },"node_modules/color-convert": {"version": "2.0.1","resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",@@ -2169,34 +2103,6 @@"dev": true,"license": "MIT"},- "node_modules/concurrently": {- "version": "8.2.2",- "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz",- "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==",- "dev": true,- "license": "MIT",- "dependencies": {- "chalk": "^4.1.2",- "date-fns": "^2.30.0",- "lodash": "^4.17.21",- "rxjs": "^7.8.1",- "shell-quote": "^1.8.1",- "spawn-command": "0.0.2",- "supports-color": "^8.1.1",- "tree-kill": "^1.2.2",- "yargs": "^17.7.2"- },- "bin": {- "conc": "dist/bin/concurrently.js",- "concurrently": "dist/bin/concurrently.js"- },- "engines": {- "node": "^14.13.0 || >=16.0.0"- },- "funding": {- "url": "https://github.com/open-cli-tools/concurrently?sponsor=1"- }- },"node_modules/content-disposition": {"version": "0.5.4","resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",@@ -2286,23 +2192,6 @@"node": ">= 14"}},- "node_modules/date-fns": {- "version": "2.30.0",- "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",- "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",- "dev": true,- "license": "MIT",- "dependencies": {- "@babel/runtime": "^7.21.0"- },- "engines": {- "node": ">=0.11"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/date-fns"- }- },"node_modules/dayjs": {"version": "1.11.15","resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.15.tgz",@@ -2403,13 +2292,6 @@"dev": true,"license": "ISC"},- "node_modules/emoji-regex": {- "version": "8.0.0",- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",- "dev": true,- "license": "MIT"- },"node_modules/encodeurl": {"version": "2.0.0","resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",@@ -2949,16 +2831,6 @@"node": ">=6.9.0"}},- "node_modules/get-caller-file": {- "version": "2.0.5",- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",- "dev": true,- "license": "ISC",- "engines": {- "node": "6.* || 8.* || >= 10.*"- }- },"node_modules/get-intrinsic": {"version": "1.3.0","resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",@@ -3215,16 +3087,6 @@"node": ">=0.10.0"}},- "node_modules/is-fullwidth-code-point": {- "version": "3.0.0",- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=8"- }- },"node_modules/is-glob": {"version": "4.0.3","resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",@@ -4339,16 +4201,6 @@"node": ">=8.10.0"}},- "node_modules/require-directory": {- "version": "2.1.1",- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",- "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=0.10.0"- }- },"node_modules/require-in-the-middle": {"version": "5.2.0","resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-5.2.0.tgz",@@ -4486,16 +4338,6 @@],"license": "MIT"},- "node_modules/rxjs": {- "version": "7.8.2",- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",- "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",- "dev": true,- "license": "Apache-2.0",- "dependencies": {- "tslib": "^2.1.0"- }- },"node_modules/safe-buffer": {"version": "5.2.1","resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",@@ -4625,19 +4467,6 @@"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==","license": "ISC"},- "node_modules/shell-quote": {- "version": "1.8.3",- "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",- "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">= 0.4"- },- "funding": {- "url": "https://github.com/sponsors/ljharb"- }- },"node_modules/shimmer": {"version": "1.2.1","resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz",@@ -4883,12 +4712,6 @@"source-map": "^0.6.0"}},- "node_modules/spawn-command": {- "version": "0.0.2",- "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz",- "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==",- "dev": true- },"node_modules/sprintf-js": {"version": "1.1.2","resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",@@ -4905,34 +4728,6 @@"node": ">= 0.8"}},- "node_modules/string-width": {- "version": "4.2.3",- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",- "dev": true,- "license": "MIT",- "dependencies": {- "emoji-regex": "^8.0.0",- "is-fullwidth-code-point": "^3.0.0",- "strip-ansi": "^6.0.1"- },- "engines": {- "node": ">=8"- }- },- "node_modules/strip-ansi": {- "version": "6.0.1",- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",- "dev": true,- "license": "MIT",- "dependencies": {- "ansi-regex": "^5.0.1"- },- "engines": {- "node": ">=8"- }- },"node_modules/sucrase": {"version": "3.35.1","resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz",@@ -4966,22 +4761,6 @@"node": ">= 6"}},- "node_modules/supports-color": {- "version": "8.1.1",- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",- "dev": true,- "license": "MIT",- "dependencies": {- "has-flag": "^4.0.0"- },- "engines": {- "node": ">=10"- },- "funding": {- "url": "https://github.com/chalk/supports-color?sponsor=1"- }- },"node_modules/supports-preserve-symlinks-flag": {"version": "1.0.0","resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",@@ -5167,16 +4946,6 @@"node": ">=0.6"}},- "node_modules/tree-kill": {- "version": "1.2.2",- "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",- "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",- "dev": true,- "license": "MIT",- "bin": {- "tree-kill": "cli.js"- }- },"node_modules/ts-interface-checker": {"version": "0.1.13","resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",@@ -5452,24 +5221,6 @@"lodash": "^4.17.14"}},- "node_modules/wrap-ansi": {- "version": "7.0.0",- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",- "dev": true,- "license": "MIT",- "dependencies": {- "ansi-styles": "^4.0.0",- "string-width": "^4.1.0",- "strip-ansi": "^6.0.0"- },- "engines": {- "node": ">=10"- },- "funding": {- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"- }- },"node_modules/ws": {"version": "7.5.10","resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",@@ -5502,16 +5253,6 @@"node": ">=0.4.0"}},- "node_modules/y18n": {- "version": "5.0.8",- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",- "dev": true,- "license": "ISC",- "engines": {- "node": ">=10"- }- },"node_modules/yallist": {"version": "3.1.1","resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",@@ -5519,35 +5260,6 @@"dev": true,"license": "ISC"},- "node_modules/yargs": {- "version": "17.7.2",- "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",- "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",- "dev": true,- "license": "MIT",- "dependencies": {- "cliui": "^8.0.1",- "escalade": "^3.1.1",- "get-caller-file": "^2.0.5",- "require-directory": "^2.1.1",- "string-width": "^4.2.3",- "y18n": "^5.0.5",- "yargs-parser": "^21.1.1"- },- "engines": {- "node": ">=12"- }- },- "node_modules/yargs-parser": {- "version": "21.1.1",- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",- "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",- "dev": true,- "license": "ISC",- "engines": {- "node": ">=12"- }- },"node_modules/zod": {"version": "3.25.76","resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",@@ -5585,7 +5297,7 @@},"server": {"name": "portos-server",- "version": "1.1.1",+ "version": "1.5.0","extraneous": true,"dependencies": {"axios": "^1.7.9",diff --git a/package.json b/package.jsonindex 68a1d80eb8..9abf185469 100644--- a/package.json+++ b/package.json@@ -1,15 +1,13 @@{"name": "portos",- "version": "1.6.3",+ "version": "1.6.4","private": true,"description": "Local dev machine App OS portal","author": "Adam Eivy (@antic|@atomantic)","license": "MIT","type": "module","scripts": {- "dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",- "dev:server": "cd server && npm run dev",- "dev:client": "cd client && npm run dev",+ "dev": "node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjs && node ./node_modules/pm2/bin/pm2 logs","build": "cd client && npm run build","start": "cd server && npm start","pm2:start": "node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjs",@@ -28,7 +26,6 @@"devDependencies": {"@vitejs/plugin-react": "^4.3.4","autoprefixer": "^10.4.20",- "concurrently": "^8.2.2","pm2": "^5.4.3","postcss": "^8.4.49","tailwindcss": "^3.4.17",diff --git a/server/services/pm2.js b/server/services/pm2.jsindex e6d79bdbd1..0ac317cd06 100644--- a/server/services/pm2.js+++ b/server/services/pm2.js@@ -9,12 +9,11 @@ import { extractJSONArray, safeJSONParse } from '../lib/fileUtils.js';const IS_WIN = process.platform === 'win32';-// Resolve PM2 CLI binary path from our local dependency.-// On Windows, we run `node pm2/bin/pm2` directly to avoid pm2.cmd batch file-// which creates visible CMD windows even with windowsHide:true-// (cmd.exe → pm2.cmd → node is a chain where the middle .cmd flashes a window).+// Resolve PM2 CLI binary path from our local dependency using require.resolve+// to handle hoisted node_modules correctly.const __dirname = dirname(fileURLToPath(import.meta.url));-const PM2_BIN = join(__dirname, '..', 'node_modules', 'pm2', 'bin', 'pm2');+const require = createRequire(import.meta.url);+const PM2_BIN = join(dirname(require.resolve('pm2/package.json')), 'bin', 'pm2');/*** Check if a script path is a JS file that PM2 can fork directly.@@ -26,24 +25,18 @@ function isJsScript(script) {}/**- * Spawn PM2 CLI directly via node, bypassing pm2.cmd on Windows.- * On Windows, `spawn('pm2', args, {shell:true})` runs cmd.exe → pm2.cmd → node,- * and the intermediate pm2.cmd batch file creates a visible CMD window even with- * windowsHide:true. Running `node pm2/bin/pm2` directly avoids the .cmd wrapper entirely.+ * Spawn PM2 CLI via local binary (node pm2/bin/pm2).+ * Always uses the local PM2 binary to avoid depending on a global pm2 install.+ * On Windows this also avoids pm2.cmd which creates visible CMD windows.* @param {string[]} pm2Args PM2 CLI arguments (e.g. ['jlist'], ['start', 'ecosystem.config.cjs'])* @param {object} opts Spawn options (cwd, env, etc.)* @returns {ChildProcess}*/export function spawnPm2(pm2Args, opts = {}) {- if (IS_WIN) {- // Run node with PM2's JS binary directly — no cmd.exe, no .cmd wrapper- return spawn(process.execPath, [PM2_BIN, ...pm2Args], {- windowsHide: true,- ...opts- });- }- // On non-Windows, pm2 is a JS file with shebang, runs fine directly- return spawn('pm2', pm2Args, { windowsHide: true, ...opts });+ return spawn(process.execPath, [PM2_BIN, ...pm2Args], {+ windowsHide: true,+ ...opts+ });}/**