appium启动报错Could not extract PIDs from ps output. PIDS: [], Procs: [“ps: uiautomator”]解决方法【多测师_王sir】
解决办法:
找到Appium安装目录下node_modules\appium\node_modules\appium-adb\lib\adb.js文件
修改在var outlines = stdout.split("\n")这行代码下方增加outlines.shift();注意有分号,然后重启appium即可
源码如下:
ADB.prototype.getPIDsByName = function (name, cb) {
logger.debug("Getting all processes with '" + name + "'");
this.shell("ps '" + name + "'", function (err, stdout) {
if (err) return cb(err);
stdout = stdout.trim();
var procs = [];
var outlines = stdout.split("\n");
outlines.shift(); //新增代码
_.each(outlines, function (outline) {
if (outline.indexOf(name) !== -1) {
procs.push(outline);
}