Is there a way to run a shell command from JavaScript in node-webkit? There are many questions, but this did not help me.
I am trying to create a simple desktop application to list installed tools. I created the node module 'tools-v', which is installed globally and works when I run it on the command line. This module runs several commands: npm -v, node -v, git -vetc. I am on Windows 7.
var exec = require('child_process').exec;
$(document).ready(function() {
myCmd = 'tools-v';
exec(myCmd, function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
$('#output').append('stdout: ' + stdout)
if (error !== null) {
console.log('exec error: ' + error);
}
});
});
I always get the error:
""exec error: Error: spawn ENOENT""
I tried spawn instead of exec. I also tried several other commands besides the node module. Thank.
source
share