I would like to run mongoDB MSI package from nodeJS application. I tried to follow the answer to this question but it gives me following error:
internal/child_process.js:298
throw errnoException(err, 'spawn');
^
Error: spawn UNKNOWN
at exports._errnoException (util.js:837:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at exports.spawn (child_process.js:339:9)
at exports.execFile (child_process.js:141:15)
at C:\_PROJECTs\nodejs\automation\mongoDB-setup\auto-setup.js:34:5
at C:\_PROJECTs\nodejs\automation\mongoDB-setup\lib\file.js:31:5
at C:\_PROJECTs\nodejs\automation\mongoDB-setup\lib\file.js:20:5
at FSReqWrap.oncomplete (fs.js:82:15)
When trying simple EXE file (e.g. puttygen.exe) it works.
Here is the relevant part of code I have:
'use strict'
const os = require('os'),
path = require('path'),
setup = require('child_process').execFile;
const fileName = 'mongodb.msi';
//const fileName = 'puttygen.exe';
const dest = path.join(os.homedir(), fileName);
// run the installation
setup(dest, function(err, data) {
console.log(err);
});
I am not sure whether execFile is the correct way for MSI packages as well.