{"action":"created","issue":{"url":"https://api.github.com/repos/appium/appium/issues/6768","repository_url":"https://api.github.com/repos/appium/appium","labels_url":"https://api.github.com/repos/appium/appium/issues/6768/labels{/name}","comments_url":"https://api.github.com/repos/appium/appium/issues/6768/comments","events_url":"https://api.github.com/repos/appium/appium/issues/6768/events","html_url":"https://github.com/appium/appium/issues/6768","id":172937622,"number":6768,"title":"appium cannot be installed via Ansible, Salt or Shell script","user":{"login":"shane51","id":4371504,"avatar_url":"https://avatars.githubusercontent.com/u/4371504?v=3","gravatar_id":"","url":"https://api.github.com/users/shane51","html_url":"https://github.com/shane51","followers_url":"https://api.github.com/users/shane51/followers","following_url":"https://api.github.com/users/shane51/following{/other_user}","gists_url":"https://api.github.com/users/shane51/gists{/gist_id}","starred_url":"https://api.github.com/users/shane51/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane51/subscriptions","organizations_url":"https://api.github.com/users/shane51/orgs","repos_url":"https://api.github.com/users/shane51/repos","events_url":"https://api.github.com/users/shane51/events{/privacy}","received_events_url":"https://api.github.com/users/shane51/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/appium/appium/labels/NeedsTriage","name":"NeedsTriage","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-24T12:24:34Z","updated_at":"2016-08-24T12:48:25Z","closed_at":null,"body":"## The problem\r\n\r\nRecently, I'm trying to use Ansible, SaltStack + Vagrant to setup appium dev env.  When using ansible or Salt to do  `npm install`, appium always return error, however, appium was successfully installed already. \r\n\r\n\r\n## Environment\r\n\r\n* Appium version (or git revision) that exhibits the issue: 1.5.3  with npm install\r\n* Last Appium version that did not exhibit the issue (if applicable): null\r\n* Desktop OS/version used to run Appium: unbuntu 14.04 ( vagrant box: ubuntu/trusty64)\r\n* Node.js version (unless using Appium.app|exe):  v6.4.0\r\n* Mobile platform/version under test: null\r\n* Real device or emulator/simulator: null\r\n* Appium CLI or Appium.app|exe: null\r\n\r\n## Details\r\n \r\n#### error with ansible npm install:\r\n\r\n```\r\nfatal: [default]: FAILED! => {\"changed\": false, \"cmd\": \"/usr/bin/npm install --global appium\", \"failed\": true, \"msg\": \"\", \"rc\": 1, \"stderr\": \"\\n\\n\", \"stdout\": \"/usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js\\n/usr/bin/authorize-ios -> /usr/lib/node_modules/appium/node_modules/.bin/authorize-ios\\n\\n> appium-chromedriver@2.9.2 install /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver\\n> node install-npm.js\\n\\n\", \"stdout_lines\": [\"/usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js\", \"/usr/bin/authorize-ios -> /usr/lib/node_modules/appium/node_modules/.bin/authorize-ios\", \"\", \"> appium-chromedriver@2.9.2 install /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver\", \"> node install-npm.js\", \"\"]}\r\n```\r\n\r\n#### error with Salt npm install:\r\n\r\n```\r\n[INFO    ] Running state [oracle-java8-installer] at time 08:54:41.575894\r\n[INFO    ] Executing state pkg.installed for oracle-java8-installer\r\n[INFO    ] Package oracle-java8-installer is already installed\r\n[INFO    ] Completed state [oracle-java8-installer] at time 08:54:41.579994 duration_in_ms=4.1\r\n[INFO    ] Running state [appium] at time 08:54:41.582858\r\n[INFO    ] Executing state npm.installed for appium\r\n[INFO    ] Executing command 'npm list --silent --json --global' in directory '/root'\r\n[INFO    ] Executing command 'npm install --silent --json  --global appium' in directory '/root'\r\n[ERROR   ] Command 'npm install --silent --json  --global appium' failed with return code: 1\r\n[ERROR   ] stdout: /usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js\r\n/usr/bin/authorize-ios -> /usr/lib/node_modules/appium/node_modules/.bin/authorize-ios\r\n[ERROR   ] retcode: 1\r\n[ERROR   ] Error installing 'appium': \r\n[INFO    ] Completed state [appium] at time 08:57:01.074710 duration_in_ms=139491.852\r\n```\r\n\r\n**We debugged ansible and found appium returns code 1 after installed successfully**\r\n\r\n\r\n## Link to Appium logs\r\n\r\n\r\n## Code To Reproduce Issue [ Good To Have ]\r\n\r\nWe found another simple way to reproduce:\r\n\r\n#### pre-requisite:\r\nEnsure appium is **NOT** installed or uninstalled \r\nOS: ubuntu\r\n\r\n#### Steps to reproduce\r\n\r\n1 Create a shell script:\r\n```shell\r\n# test_appium_exit_code_1.sh\r\nsudo npm install -g appium\r\n```\r\n2 Change mode to +x to run shell\r\n\r\n```shell\r\nchmod +x test_appium_exit_code_1.sh\r\n```\r\n\r\n3 run:\r\n\r\n```shell\r\n./test_appium_exit_code_1.sh\r\n```\r\n\r\n4 Will see stdout as below:\r\n```\r\n/usr/bin/authorize-ios -> /usr/lib/node_modules/appium/node_modules/.bin/authorize-ios\r\n/usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js\r\n\r\n> appium-chromedriver@2.9.2 install /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver\r\n> node install-npm.js\r\n```\r\nand installation process exit.\r\n#### Actual result:\r\n\r\n**When check the return code as below, we will get `1`**\r\n\r\n```\r\necho $?\r\n```\r\nSince Ansible or Salt use script to run appium, so they will get code `1` from appium, which breaks Ansible or Salt process\r\n#### Expected result:\r\n\r\nRun Appium install with script should return code `0`"},"comment":{"url":"https://api.github.com/repos/appium/appium/issues/comments/242050413","html_url":"https://github.com/appium/appium/issues/6768#issuecomment-242050413","issue_url":"https://api.github.com/repos/appium/appium/issues/6768","id":242050413,"user":{"login":"mykola-mokhnach","id":7767781,"avatar_url":"https://avatars.githubusercontent.com/u/7767781?v=3","gravatar_id":"","url":"https://api.github.com/users/mykola-mokhnach","html_url":"https://github.com/mykola-mokhnach","followers_url":"https://api.github.com/users/mykola-mokhnach/followers","following_url":"https://api.github.com/users/mykola-mokhnach/following{/other_user}","gists_url":"https://api.github.com/users/mykola-mokhnach/gists{/gist_id}","starred_url":"https://api.github.com/users/mykola-mokhnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykola-mokhnach/subscriptions","organizations_url":"https://api.github.com/users/mykola-mokhnach/orgs","repos_url":"https://api.github.com/users/mykola-mokhnach/repos","events_url":"https://api.github.com/users/mykola-mokhnach/events{/privacy}","received_events_url":"https://api.github.com/users/mykola-mokhnach/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T12:48:25Z","updated_at":"2016-08-24T12:48:25Z","body":"Are you trying to install Appium on a clean machine or it is already present there?"}}
{"actor":{"display_login":"mykola-mokhnach"}}