About JSON parsing.  I had some issues getting JSON to parse, but today I figured them out.
Here would be the updated parsing with JSON:
- - - - - - - - - - - - - - - -
var nodePathAppiumConfig = function() {
  var appiumconfig = 'node_modules/appium/.appiumconfig';
  // Adding "|| echo 'file not found'" in case "cat config file" fails - this
  // avoids sysExec throwing execption and returns data string here which will
  // then not parse for node_bin.
  var data = sysExec("/bin/cat " + appiumconfig + " || echo 'file not found'");
  if (!data || data === 'file not found') {
    console.log("WARN: Could not get .appiumconfig file: " + appiumconfig);
    return null;
  }
  try {
    var jsonobj = JSON.parse(data.toString('utf8'));
    if (jsonobj.node_bin !== undefined) { 
      return jsonobj.node_bin;
    } 
    // This setup does not have node_bin configured in appiumconfig.
    return null;
  } catch(e) {
    console.log("WARN: JSON parse of .appiumconfig failed: " + e);
  }
  return null;
};
- - - - - - - - - - - - - - - -