简体   繁体   中英

Node.js - execFile throws spawn UNKNOWN

I am trying to spawn a service created with pyInstaller from an electron application. I am using the following code for that:

return new Promise((reject, resolve)=>{
var exec = require('child_process').execFile;
    exec(path.join(install_path, 'myService.exe'), ['--startup=auto', 'install'], function(err, data) { 
        if(err) {            
            reject(err);
            return;
        }
        console.log(data.toString()); 
        exec(path.join(install_path, 'myService.exe'), ['start'], function(err, data){
            if(err) {
                reject(err);
                return;
            }
            resolve(data.toString());
        })                      
    }); 
}

Unfortunately, this throws an

Uncaught Error: spawn UNKNOWN

on a testing system, which does not have node installed and is running Windows 10 x64. On my machine it is working fine. Does anyone have tips how I could investigate this further? I am especially curious how this error is uncaught, because the callback functions obviously contain simple error handling.

Okay, after I built in better error handling thanks to Keiths help and rebuilt the project, the testers could not reproduce the issue anymore. I am still not sure if that actually fixed the problem or if the testers pulled an old version the last time. Anyway, this is solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM