node module to check if a command-line command exists
npm install command-exists
var commandExists = require('command-exists');
commandExists('ls', function(err, commandExists) {
if(commandExists) {
// proceed confidently knowing this command is available
}
});