Appium Doctor iOS Could not detect Mac OS X Version from sw_vers output: '10.12 '解决方法

本文提供了一种解决Appium在MacOS 10.12.3上运行时遇到的兼容性问题的方法。通过修改特定文件中的系统版本判断代码,使Appium能够正确识别并运行在MacOS 10.12.3版本上。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自:https://blog.youkuaiyun.com/achang21/article/details/64922632

亲测有效!

步骤一、

vi /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js
修改:
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.3'];
    _i = 0;
步骤二、
vi /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js
(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.3']) {
if (stdout.indexOf(v) === 0) { return v; }
}
步骤三、
vi /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js
修改:
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.3'];
    _i = 0;
步骤四、
vi /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
(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.3']) {
if (stdout.indexOf(v) === 0) { return v; }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值