Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow starting Appium.app from commandline without global install of nodejs #793

Closed
wants to merge 2 commits into from

Conversation

tokunbo
Copy link

@tokunbo tokunbo commented Jun 20, 2013

WIthout this code modification, Appium.app won't start from the commandline when the machine doesn't have nodejs globally installed. Instead you hit the exception about not being able to find node.

…on machine without a global nodejs install.
@xuru
Copy link
Contributor

xuru commented Jun 20, 2013

I would suggest having an array of possible node locations and loop through them in order using fileExists to determine if it's available. Once found, break out of the loop and go own with life, otherwise present the error to the user.

@penguinho
Copy link
Member

the proper way to do this is with applescript. There is a node path property on Appium.app (for those who don't put i in the applications folder) jlipps already does this somewhere else in the same file

@penguinho
Copy link
Member

var appScript = [
'try'
, ' set appiumIsRunning to false'
, ' tell application "System Events"'
, ' set appiumIsRunning to name of every process contains "Appium"'
, ' end tell'
, ' if appiumIsRunning then'
, ' tell application "Appium" to return node path'
, ' end if'
, 'end try'
, 'return "NULL"'
].join("\n");
var appNodeWorked = false;
try {
path = sysExec("osascript -e '" + appScript + "'");
appNodeWorked = path !== "NULL";
} catch(e) {}

@tokunbo
Copy link
Author

tokunbo commented Jun 20, 2013

Yeah... that code is in there... it doesn't work when running Appium.app from the command line.
Notice that my code is only hit after that applescript, and 2 other directories, fail to contain node.

@bootstraponline
Copy link
Member

Is the consensus to merge this or not? It sounds like there are better ways to fix the issue.

@penguinho
Copy link
Member

I don't think we can hardcoe a guess to the /Application folder, that assumes that's where people put it, which often they don't we should correct this diff to use AppleScript and let LaunchServices find Appium.app

@bootstraponline
Copy link
Member

use AppleScript and let LaunchServices find Appium.app

That sounds good to me.

@jlipps
Copy link
Member

jlipps commented Jun 25, 2013

+1 on using applescript if that's more robust. Will that work @tokunbo?

@tokunbo
Copy link
Author

tokunbo commented Jun 25, 2013

@jlipps It already looks to me that it doesn't work. My little code addition is only reached after the failure of applescript and 2 hardcored paths. But, if there's something else that can be done that I'm not aware of, good times.

I just need a way for Appium.app to allow me to start it via commandline without starting the Appium GUI, e.g.

cd /Applications/Appium.app/Contents/Resources/node_modules/appium
../../node/bin/node server.js -U $UUID --app com.companyname.appname --native-instruments-lib -a 0.0.0.0 -p 4444 > $ORIGINAL_WORKDIR/$DEVICENAME.appiumdebug.log 2>&1 &

Any fix that allows me to run Appium.app like the above is okay with me. ^_^

@jlipps
Copy link
Member

jlipps commented Jun 25, 2013

If you're trying to run stuff from the command line, why bother with appium.app at all?

@tokunbo
Copy link
Author

tokunbo commented Jun 25, 2013

@jlipps
Ah!!! Because I keep screwing up my nodejs install when it comes to appium. So, I just plain skip installing nodejs globally and use the nodejs that's inside the Appium.app folder structure. :-)

@jlipps
Copy link
Member

jlipps commented Jun 25, 2013

Haha. Well it sounds like there's a much better solution out there for you, in the guise of installing a global node binary that works! I'd rather help you debug that at the hackathon on Monday than build this somewhat odd feature.

@penguinho penguinho closed this Jun 25, 2013
@tokunbo
Copy link
Author

tokunbo commented Jun 25, 2013

penguinho with those ninja-closes.

Well, probably my issues were related to me not understanding the difference between "npm install" versus "sudo npm install" versus "brew install node" versus installing nodejs.dmg or something...

@jlipps
Copy link
Member

jlipps commented Jun 25, 2013

I recommend brew install node. With that method you never need to sudo npm install anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants