I am trying to figure out the appium script path to pass to node to get it to run inside my java application.
In windows it would be:
public static String APPIUM_NODE_FILEPATH = "C:/Program Files (x86)/Appium/node.exe";
public static String APPIUM_SERVERSCRIPT_FILEPATH = "C:/Program Files (x86)/Appium/node_modules/appium/bin/appium.js";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(APPIUM_NODE_FILEPATH.getAbsolutePath() , APPIUM_SERVERSCRIPT_FILEPATH.getAbsolutePath(), "--log-timestamp", "--log", new File(target, "appiumMCBLogger.txt").getAbsolutePath());
In CentOS I can not find the /appium/bin/appium.js file (it's not installed). Is something wrong with my installation or is there another file I should be passing to node.
I see node_modules/appium/build/lib/appium.js but this will give an error
localhost node_modules]$ /usr/bin/node /home/miw/node_modules/appium/lib/appium.js
/home/miw/node_modules/appium/lib/appium.js:1
(function (exports, require, module, __filename, __dirname) { import _ from 'lodash';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:449:3
In the end I just used npm install -g appium and then ran "appium".
Does anyone know if this is the correct way on linux?
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("appium", "--log-timestamp", "--log", new File(target, "appiumMCBLogger.txt").getAbsolutePath());