hop of those help? No, it will virtually never be necessary. In fact, the values returned by require are cached, so the first call to require("foo") actually runs the module, while additional calls simply access the original return value stored in require.cache (in particular, require.cache[require.resolve("foo")]). The only case multiple calls would be necessary (or have any effect whatsoever) is if your code tampers with require.cache, which it probably shouldn't do.
require('child_process').execFile() does not work?
By : Navin Ramesh
Date : March 29 2020, 07:55 AM
hope this fix your issue Most likely because execFile is not creating a shell so it doesn't know how to find the python interpreter. Try:
To fix the issue you can do You can't run a child process through a web browser, unless your app is running in a desktop app container such as Electron (which makes Node modules available within its web runtime). It would be horrendously insecure to allow browsers to execute shell scripts - imagine if a pop-up was able to download a .bat and immediately run it on your machine... That said, if you want the batch file to run on the server and just be triggered by the client, that's perfectly feasible - just call child_process.spawn() in response to a REST call of some kind.