如何修复错误"无法从sw_vers输出中检测到Mac OS X版本:' 10.12'"来自Appium

时间:2016-10-19 11:10:53

标签: android automated-tests appium

我安装了appium-1.5.3.dmg但是当我点击听诊器按钮时,Appium显示错误:

 ✔ Xcode is installed at: /Library/Developer/CommandLineTools
[Error: Could not detect Mac OS X Version from sw_vers output: '10.12
']

enter image description here

谢谢!

2 个答案:

答案 0 :(得分:30)

这对我有用。

您可以通过此命令配置文件:

  • grep -rl“无法从sw_vers输出中检测到Mac OS X版本:”/ Applications / Appium.app /

enter image description here

  • 终端将显示: /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js

  • 使用命令vim并配置每个文件。

实施例

vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js

enter image description here

配置文件:

enter image description here

  1. 更改自 - >

    case 10: _arr = ['10.8', '10.9', '10.10', '10.11']; _i = 0;

    收件人 - >

    case 10: _arr = ['10.8', '10.9', '10.10', '10.11','10.12']; _i = 0;

  2. vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js
    

    enter image description here

    配置文件:

    enter image description here

    1. 更改自 - >

      try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout; }

      To - >

      try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim(); }

    2. 更改自 - >

      for (let v of ['10.8', '10.9', '10.10', '10.11']) { if (stdout.indexOf(v) === 0) { return v; } }

      收件人 - >

      for (let v of ['10.8', '10.9', '10.10', '10.11','10.12']) { if (stdout.indexOf(v) === 0) { return v; } }

    3. vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js
      

      enter image description here

      配置文件:

      enter image description here

      1. 更改自 - >

        case 10: _arr = ['10.8', '10.9', '10.10', '10.11']; _i = 0;

        收件人 - >

        case 10: _arr = ['10.8', '10.9', '10.10', '10.11','10.12']; _i = 0;

      2. vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
        

        enter image description here

        配置文件:

        enter image description here

        1. 更改自 - >

          try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout; }

          收件人 - >

          try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim(); }

        2. 更改自 - >

          for (let v of ['10.8', '10.9', '10.10', '10.11']) { if (stdout.indexOf(v) === 0) { return v; } }

          收件人 - >

          for (let v of ['10.8', '10.9', '10.10', '10.11','10.12']) { if (stdout.indexOf(v) === 0) { return v; } }

        3. 点击启动听诊器按钮

          enter image description here

答案 1 :(得分:0)

I went through the above steps even though I saw that it's been fixed by appium already.

Just run:

npm install appium-doctor -g

to update appium-doctor itself, then run:

appium-doctor

again to see it work.

Before and after fix:

enter image description here