From 908b308c304bd309ae22624cc287cf7191355c00 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 4 Feb 2020 11:10:02 -0800 Subject: [PATCH] Automatic set of npmpath if possible. --- meshcentral.js | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/meshcentral.js b/meshcentral.js index 3afecc7d..38e3cc51 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -1247,6 +1247,15 @@ function CreateMeshCentralServer(config, args) { if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) { setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000); } + + // 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. + if (obj.args.npmpath == null) { + try { + var nodepath = process.argv[0]; + var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm'); + if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) { obj.args.npmpath = (nodepath + ' ' + npmpath); } + } catch (ex) { } + } }); }); }; diff --git a/package.json b/package.json index 19e0f18b..6a593133 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.8-l", + "version": "0.4.8-m", "keywords": [ "Remote Management", "Intel AMT",