Appium Appium 连接 iphone 报错。Error: Unable to launch WebDriverAgent because of xcodebuild failure: "Unable to start iproxy. Is it installed?".

季文洪 · 2018年03月17日 · 最后由 古古阁 回复于 2018年11月13日 · 3263 次阅读

[MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: "Unable to start iproxy. Is it installed?". Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.

我想知道这个 iproxy 是在哪一步安装上的。
环境按照操作步骤安装,没有遇到 error 啊,怎么 iproxy 没有安装?

共收到 8 条回复 时间 点赞

重新做了一遍,运行 bootstrap 的时候遇到了问题。我按照https://testerhome.com/topics/7192这个帖子的办法试了一下,最终执行结果是这样的。是不是还是有问题啊?

MacMini-J:WebDriverAgent MacMini_J$ sh ./Scripts/bootstrap.sh
-e Fetching dependencies
-e Building Inspector
Creating bundle directory...
Fetching Inspector dependencies...
npm WARN react-dom@15.6.2 requires a peer of react@15.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN web-driver-inspector@1.0.0 No repository field.

up to date in 6.967s
Validating Inspector
No errors!

Oops! Something went wrong! :(

ESLint couldn't find the plugin "eslint-plugin-mocha". This can happen for a couple different reasons:

  1. If ESLint is installed globally, then make sure eslint-plugin-mocha is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

  2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-mocha@latest --save-dev

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

按照上面的提示执行 npm i eslint-plugin-mocha@latest --save-dev ,又遇到一个坑😢
MacMini-J:WebDriverAgent MacMini_J$ npm i eslint-plugin-mocha@latest --save-dev
npm WARN request-promise-core@1.1.1 requires a peer of request@2.34 but none is installed. You must install peer dependencies yourself.
npm WARN request-promise-core@1.1.1 requires a peer of request@2.34 but none is installed. You must install peer dependencies yourself.
npm WARN request-promise-core@1.1.1 requires a peer of request@2.34 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-mocha@4.12.1 requires a peer of eslint@2.0.0 || 3.0.0 || 4.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! Maximum call stack size exceeded

尝试单独装,在执行 sh 脚本,还是没有解决
MacMini-J:WebDriverAgent MacMini_J$ npm install -g eslint
/usr/local/bin/eslint -> /usr/local/lib/node_modules/eslint/bin/eslint.js

  • eslint@4.19.0 added 1 package and updated 1 package in 39.617s

MacMini-J:WebDriverAgent MacMini_J$ npm install -g eslint-plugin-mocha
npm WARN eslint-plugin-mocha@4.12.1 requires a peer of eslint@2.0.0 || 3.0.0 || 4.0.0 but none is installed. You must install peer dependencies yourself.

  • eslint-plugin-mocha@4.12.1 added 2 packages from 6 contributors in 3.779s

首先,你先确认下,iproxy 有没有安装

LUY43327:~ labone$ which iproxy 
/usr/local/bin/iproxy  

如果没有安装,自行安装 iproxy;
如果已安装,找到/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/build/lib这个目录,打开iproxy.js,修改如下方法重点是把 iproxy 改成/usr/local/bin/iproxy

var iProxy = (function () {
  function iProxy(udid, localport, deviceport) {
    _classCallCheck(this, iProxy);

    _logger2['default'].debug('Starting iproxy to forward traffic from local port ' + localport + ' to device port ' + deviceport + ' over USB');
    this.expectIProxyErrors = true;
    this.iproxy = new _teen_process.SubProcess('/usr/local/bin/iproxy', [localport, deviceport, udid], {
      detached: true,
      stdio: ['ignore', 'pipe', 'pipe']
    });
  }
于超 回复

iproxy 没有安装。是这样安装吗:

MacMini-J:WebDriverAgent MacMini_J$ sudo cnpm install --global iproxy
Password:
Downloading iproxy to /usr/local/lib/node_modules/iproxy_tmp
Copying /usr/local/lib/node_modules/iproxy_tmp/_iproxy@0.0.4@iproxy to /usr/local/lib/node_modules/iproxy
Installing iproxy's dependencies to /usr/local/lib/node_modules/iproxy/node_modules
[1/1] fresh@~0.2.0 installed at node_modules/_fresh@0.2.4@fresh
All packages installed (1 packages installed from npm registry, used 3s, speed 2.4kB/s, json 1(5.08kB), tarball 2.26kB)

执行完这个之后,再用 which iproxy 看,还是没有结果。
还有这个也试过:
MacMini-J:WebDriverAgent MacMini_J$ sudo npm install --global iproxy
Password:

  • iproxy@0.0.4 updated 2 packages in 6.425s
于超 回复

安装完 iproxy,但是 which iproxy,啥也没有:

MacMini-J:node_modules MacMini_J$ npm install -g iproxy
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/iproxy
npm ERR! path /usr/local/lib/node_modules/iproxy
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/iproxy'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/iproxy'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/iproxy\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/iproxy' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

MacMini-J:node_modules MacMini_J$ sudo npm install -g iproxy

  • iproxy@0.0.4 updated 1 package in 2.12s

MacMini-J:node_modules MacMini_J$ which iproxy

MacMini-J:node_modules MacMini_J$ iproxy
-bash: iproxy: command not found

@jwhong_zh
git clone https://github.com/appium/WebDriverAgent.git 用户家目录

// 重新编译wda
sh ./Scripts/bootstrap.sh

待成功之后,copy 到 appium 的 appium-xcuitest-driver 目录下,替换掉WebDriverAgent

老哥,你的问题解决了没有啊,我 sh ./Scripts/bootstrap.sh 跟你一样的报错

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册