appium cannot be installed via Ansible, Salt or Shell script
See original GitHub issueThe problem
Recently, 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.
Environment
- Appium version (or git revision) that exhibits the issue: 1.5.3 with npm install
- Last Appium version that did not exhibit the issue (if applicable): null
- Desktop OS/version used to run Appium: unbuntu 14.04 ( vagrant box: ubuntu/trusty64)
- Node.js version (unless using Appium.app|exe): v6.4.0
- Mobile platform/version under test: null
- Real device or emulator/simulator: null
- Appium CLI or Appium.app|exe: null
Details
error with ansible npm install:
fatal: [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", ""]}
error with Salt npm install:
[INFO ] Running state [oracle-java8-installer] at time 08:54:41.575894
[INFO ] Executing state pkg.installed for oracle-java8-installer
[INFO ] Package oracle-java8-installer is already installed
[INFO ] Completed state [oracle-java8-installer] at time 08:54:41.579994 duration_in_ms=4.1
[INFO ] Running state [appium] at time 08:54:41.582858
[INFO ] Executing state npm.installed for appium
[INFO ] Executing command 'npm list --silent --json --global' in directory '/root'
[INFO ] Executing command 'npm install --silent --json --global appium' in directory '/root'
[ERROR ] Command 'npm install --silent --json --global appium' failed with return code: 1
[ERROR ] stdout: /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
[ERROR ] retcode: 1
[ERROR ] Error installing 'appium':
[INFO ] Completed state [appium] at time 08:57:01.074710 duration_in_ms=139491.852
We debugged ansible and found appium returns code 1 after installed successfully
Link to Appium logs
Code To Reproduce Issue [ Good To Have ]
We found another simple way to reproduce:
pre-requisite:
Ensure appium is NOT installed or uninstalled OS: ubuntu
Steps to reproduce
1 Create a shell script:
# test_appium_exit_code_1.sh
sudo npm install -g appium
2 Change mode to +x to run shell
chmod +x test_appium_exit_code_1.sh
3 run:
./test_appium_exit_code_1.sh
4 Will see stdout as below:
/usr/bin/authorize-ios -> /usr/lib/node_modules/appium/node_modules/.bin/authorize-ios
/usr/bin/appium -> /usr/lib/node_modules/appium/build/lib/main.js
> appium-chromedriver@2.9.2 install /usr/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver
> node install-npm.js
and installation process exit.
Actual result:
When check the return code as below, we will get 1
echo $?
Since Ansible or Salt use script to run appium, so they will get code 1
from appium, which breaks Ansible or Salt process
Expected result:
Run Appium install with script should return code 0
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
Saltstack vs Ansible | Top 12 Differences You Should Know
Ansible is a deployment tool with more of scripting as Shell and Python are used here. All the machines are coordinated into one...
Read more >Appium 1.20.2 - Chocolatey
To install Appium, run the following command from the command line or from PowerShell: · To upgrade Appium, run the following command from...
Read more >node.js - How do I install appium on Ubuntu? - Stack Overflow
Install Linux Brew:(Copy the command to terminal and press enter) ... Finally Install Appium: Appium is installed via npm There are two ways ......
Read more >Courses for Enterprise Developer to DevOps Engineer - Track 2
Learners work with Docker CLI to create and manage networks, and then learn how to install, configure, and build a project by using...
Read more >What Is an Automation Engineer? How to Become One, Salary ...
Research, develop and install automation solutions for machinery or software applications. ... Create Automation Tool Using Ansible, Shell - Linux ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could change the command to
if you want to workaround the issue. But I cannot understand why do you need sudo to execute npm installer? In theory it should work without root privileges and should create executable symlinks in /usr/local/bin folder, which does not require elevated permissions for writing.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.