Automatic set of npmpath if possible.

Ylian Saint-Hilaire committed Feb 4, 2020 at 11:10 UTC 908b308c304bd309ae22624cc287cf7191355c00
2 files changed +10 -1
meshcentral.js
+9
@@ -1247,6 +1247,15 @@ function CreateMeshCentralServer(config, args) {
1247 if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) {
1248 setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000);
1249 }
1250 +
1251 + // Setup the Node+NPM path if possible, this makes it possible to update the server even if NodeJS and NPM are not in default paths.
1252 + if (obj.args.npmpath == null) {
1253 + try {
1254 + var nodepath = process.argv[0];
1255 + var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm');
1256 + if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) { obj.args.npmpath = (nodepath + ' ' + npmpath); }
1257 + } catch (ex) { }
1258 + }
1259 });
1260 });
1261 };
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.4.8-l",
3 + "version": "0.4.8-m",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",