[Appium][Issue][1.2.2] iOS log capture failed: spawn ENOENT (deviceconsole)

Appium 1.2.2 一啟動 iOS 時會出現下面的錯誤:

info: [debug] Starting iOS device log capture via deviceconsole
error: iOS log capture failed: spawn ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn ENOENT
info: [debug] Error: spawn ENOENT
    at errnoException (child_process.js:1000:11)
    at Process.ChildProcess._handle.onexit (child_process.js:791:34)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
info: <-- POST /wd/hub/session 500 1780.745 ms - 197
info: [debug] Not setting device type since we're connected to a device
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating iDevice object with udid 816008f7ad15fcdc53f97dec30ad6e543d186faa
info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 816008f7ad15fcdc53f97dec30ad6e543d186faa --bundle tw.com.skysoft.iPhone

原因是 Appium 1.2.2 開始改用 deviceconsole (#3430),但 $APPIUM_HOME/build/deviceconsole 底下卻又找不到 deviceconsole 的關係。


IosLog.prototype.startCapture = function (cb) {
  this.onIosLogStart = cb;
  // Select cmd for log capture
  if (this.udid) {
    var spawnEnv = _.clone(process.env);
    var limdDir = path.resolve(__dirname,
    spawnEnv.PATH = process.env.PATH + ":" + limdDir; // 1
    spawnEnv.DYLD_LIBRARY_PATH = limdDir + ":" + process.env.DYLD_LIBRARY_PATH;
    logger.debug("Starting iOS device log capture via deviceconsole");
    // deviceconsole retrieves many old device log lines that came before it was
    // started so filter those out until we encounter new log lines.
    this.loggingModeOn = false;
    this.proc = spawn("deviceconsole", ["-u", this.udid], {env: spawnEnv}); // 1
1 自動把 $APPIUM_HOME/build/deviceconsole 加到 $PATH,才能呼叫到底下的 deviceconsole

確實安裝完 Appium 1.2.2 之後,$APPIUM_HOME/build/deviceconsole/deviceconsole 這個執行檔是不存在的,手動 compile 就可以解掉這個問題。

$ cd /usr/local/lib/node_modules/appium/build/deviceconsole
$ make

這個問題已經回報 #3503 After upgrading to 1.2.2 (from 1.2.1), fail to start iOS device log capture via deviceconsole,應該將 compile 的動作在安裝時自動做掉。





WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s