Giter Site home page Giter Site logo

macaca server运行失败 about macaca HOT 9 CLOSED

1161004155 avatar 1161004155 commented on August 22, 2024
macaca server运行失败

from macaca.

Comments (9)

happybeta avatar happybeta commented on August 22, 2024

我也和你差不多的问题。不同的是,我是Android平台的。

  1. macaca doctor是正常的, 都绿了。
macaca doctor

  macaca-doctor version: 2.0.18


  Node.js checklist:

  node env: C:\Program Files\nodejs\node.exe
  node version: v12.18.3

  Android checklist:

  JAVA version is `1.8`
  JAVA_HOME is set to `C:\Program Files\Java\jdk1.8.0_151`
  ANDROID_HOME is set to `D:\android\Sdk`
  Platforms is set to `D:\android\Sdk\platforms\android-30`
  ADB tool is set to `D:\android\Sdk\platform-tools\adb.exe`
  GRADLE_HOME is set to `C:\Users\Desktop\自主测试\nosmoke\gradle-7.5`

  Installed driver list:

  android: 2.2.1
  location: C:\Users\AppData\Roaming\npm\node_modules\macaca-android

2 , 启动macaca server失败,换了个多个版本,都提示:

C:\Users\user>macaca server --verbose
>> request.js:11:12 [master] pid:12876 get remote update info failed.
>> index.js:15:12 [master] pid:16828 webdriver server start with config:
 {
  port: 3456,
  verbose: true,
  always: true,
  ip: 'masked',
  host: 'masked',
  loaded_time: '2022-07-26 17:29:40'
}
>> middlewares.js:17:10 [master] pid:16828 base middlewares attached
>> index.js:40:14 [master] pid:16828 webdriver server failed to start: Error: get `/wd/hub/status`: `middleware` must be a function, not `undefined`
    at Layer.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\layer.js:38:13)
    at Array.forEach (<anonymous>)
    at new Layer (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\layer.js:35:14)
    at Router.register (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\router.js:503:15)
    at Router.<computed> [as get] (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\router.js:184:10)
    at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\router.js:53:6)
    at C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\index.js:36:7
    at new Promise (<anonymous>)
    at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\index.js:14:10)
    at Webdriver.start (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\index.js:24:10)
(node:16828) UnhandledPromiseRejectionWarning: Error: get `/wd/hub/status`: `middleware` must be a function, not `undefined`
    at Layer.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\layer.js:38:13)
    at Array.forEach (<anonymous>)
    at new Layer (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\layer.js:35:14)
    at Router.register (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\router.js:503:15)
    at Router.<computed> [as get] (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\koa-router\lib\router.js:184:10)
    at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\router.js:53:6)
    at C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\index.js:36:7
    at new Promise (<anonymous>)
    at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\server\index.js:14:10)
    at Webdriver.start (C:\Users\user\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\webdriver-server\lib\index.js:24:10)
(node:16828) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:16828) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


from macaca.

candialala avatar candialala commented on August 22, 2024

from macaca.

CodeByShawn avatar CodeByShawn commented on August 22, 2024

同样问题,有解决方案吗?

from macaca.

CodeByShawn avatar CodeByShawn commented on August 22, 2024

请问有解决吗

from macaca.

AtuboDad avatar AtuboDad commented on August 22, 2024

同样问题,有解决方案吗?

from macaca.

candialala avatar candialala commented on August 22, 2024

from macaca.

1161004155 avatar 1161004155 commented on August 22, 2024

macaca server启动,中间件报错,需要修改/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/controllers/cookie.js,替换为下面的内容:

'use strict';

function *getAllCookies(next) {
  this.state.value = yield this.device.getAllCookies();
  yield next;
}

function *getNamedCookie(next) {
  const body = this.request.body;
  const name = body.name;

  this.state.value = yield this.device.getNamedCookie(name);
  yield next;
}

function *addCookie(next) {
  const body = this.request.body;
  const cookie = body.cookie;
  this.state.value = yield this.device.addCookie(cookie);
  yield next;
}

function *deleteCookie(next) {
  const name = this.request.body.name || this.params.name;

  this.state.value = yield this.device.deleteCookie(name);
  yield next;
}

function *deleteAllCookies(next) {
  this.state.value = yield this.device.deleteAllCookies();
  yield next;
}

module.exports = {
  getAllCookies,
  getNamedCookie,
  addCookie,
  deleteCookie,
  deleteAllCookies
};

其中一个函数的.?使用有问题,删了就可以运行,这个是js的一个正确语法,但是不知道为什么这里报错

from macaca.

candialala avatar candialala commented on August 22, 2024

from macaca.

yihuineng avatar yihuineng commented on August 22, 2024

Node 14 + 支持可选链操作符号(?.) 请升级node版本试一下

from macaca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.