@drocketxx/pm2me 1.1.30 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1130,30 +1130,39 @@ Remove-Item -Path "${scriptPath}" -Force`;
1130
1130
  cmd
1131
1131
  });
1132
1132
  } else {
1133
- // Linux: Get full paths to npm and pm2me before running detached
1134
- let npmPath, pm2mePath;
1133
+ // Linux: Get full paths to npm, pm2me, and node before running detached
1134
+ let npmPath, pm2mePath, nodePath, binDir;
1135
1135
  try {
1136
1136
  const npmResult = await execAsync('which npm');
1137
1137
  npmPath = npmResult.stdout.trim();
1138
+ binDir = path.dirname(npmPath); // e.g., /root/.nvm/versions/node/v22.21.1/bin
1138
1139
  } catch {
1139
- npmPath = '/usr/bin/npm'; // fallback
1140
+ npmPath = '/usr/bin/npm';
1141
+ binDir = '/usr/bin';
1140
1142
  }
1141
1143
  try {
1142
1144
  const pm2meResult = await execAsync('which pm2me');
1143
1145
  pm2mePath = pm2meResult.stdout.trim();
1144
1146
  } catch {
1145
- pm2mePath = 'pm2me'; // fallback to PATH
1147
+ pm2mePath = 'pm2me';
1148
+ }
1149
+ try {
1150
+ const nodeResult = await execAsync('which node');
1151
+ nodePath = nodeResult.stdout.trim();
1152
+ } catch {
1153
+ nodePath = path.join(binDir, 'node'); // Same dir as npm
1146
1154
  }
1147
1155
 
1148
1156
  const scriptPath = '/tmp/pm2me-update.sh';
1149
1157
  const logPath = '/tmp/pm2me-update.log';
1150
1158
  const scriptContent = `#!/bin/bash
1151
- # Source user environment to get proper PATH
1152
- [ -f ~/.bashrc ] && source ~/.bashrc
1153
- [ -f ~/.profile ] && source ~/.profile
1159
+ # Add Node.js bin directory to PATH
1160
+ export PATH="${binDir}:$PATH"
1154
1161
 
1155
1162
  exec > ${logPath} 2>&1
1156
1163
  echo "[$(date)] PM2Me Update Script Started"
1164
+ echo "[$(date)] PATH: $PATH"
1165
+ echo "[$(date)] Using node: ${nodePath}"
1157
1166
  echo "[$(date)] Using npm: ${npmPath}"
1158
1167
  echo "[$(date)] Using pm2me: ${pm2mePath}"
1159
1168
  sleep 3
@@ -1211,7 +1220,7 @@ rm -f ${scriptPath}`;
1211
1220
 
1212
1221
  res.json({
1213
1222
  success: true,
1214
- output: `Update scheduled. Service will restart in ~30 seconds.\nUsing npm: ${npmPath}\nUsing pm2me: ${pm2mePath}\nLog: ${logPath}`,
1223
+ output: `Update scheduled. Service will restart in ~30 seconds.\nBin Dir: ${binDir}\nNode: ${nodePath}\nNpm: ${npmPath}\nPm2me: ${pm2mePath}\nLog: ${logPath}`,
1215
1224
  cmd
1216
1225
  });
1217
1226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drocketxx/pm2me",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "PM2 Deployment and Management System — Web UI for PM2 process management",
5
5
  "type": "module",
6
6
  "main": "backend/app.js",