STF MAC 下 STF 的环境搭建和运行

蛋蛋 · 2015年08月08日 · 5256 次阅读

STF --WEB 端批量移动设备管理控制工具

安装各种包

(首先安装 Macport,因为后面需要用到 port:http://www.ccvita.com/434.html)

  1. linux 的基本包安装,mac 之前有类似环境忽略

  2. SDK 环境安装,这里不做详细说明估计都有

    1. java
    2. android 留意安装完成后配置环境变量
  3. nodejs 安装

    1. https://nodejs.org/dist/v0.12.7/node-v0.12.7.pkg
    2. 验证 node -v
    3. 如果之前有 appium 该环境已有
  4. 安装 bower

    1. 执行
    2. sudo npm install bower -g
  5. 安装 rethinkdb

    1. 这里建议通过 pgk 安装
    2. http://download.rethinkdb.com/osx/rethinkdb-2.0.4.dmg
  6. 安装 graphicsmagick

    1. 安装 sudo port install graphicsmagick
  7. 安装 libsodium(zeromq 的依赖)

    1. sudo port install libsodium
  8. 安装 zeromp

    1. sudo port install zmq
  9. 安装 protobuf

    1. sudo port install protobuf-cpp
    2. 不用理会环境变量
  10. 安装 pkg-config

    1. sudo port install pkgconfig
  11. 安装 stf

    1. sudo npm install -g stf
    2. 时间很长
  12. 运行 stf

    1. 启动 rethinkdb
    2. 注意新建终端 --- 启动 stf,文章中给的例子实际测试无法访问 stf local —allow-remote(如果可远程访问 stf local --public-ip 本机 IP)
  13. 运行客户端

    1. 输入http://localhost:7100/ 或者 ID:7100 访问
    2. 成功,可以实现远程操作啦!

(声明:本篇文档是我领导总结的,搬过来和大家分享,😄

共收到 33 条回复 时间 点赞

排版问题。另外此方式大量采用 sudo, 会使很多初学者困扰。

这排版。。略牛。。。

这是 mac ?brew install node 装上的 node 不是可以不用 sudo 来安装 npm 包的吗?

是 mac,貌似不用 sudo 会报错

正需要~马上试试!

#1 楼 @lihuazhang 是不是可以搞成 docker

#6 楼 @seveniruby 他本身提供的。

安装的东西好多啊

“注意新建终端 --- 启动 stf,文章中给的例子实际测试无法访问 stf local —allow-remote”
LZ 可能误会这条了哈 ~~~ 这个参数是用来让 STF 允许访问通过 adb connect 命令远程连接的设备,不是远程连接 STF 用的。。。毕竟一般 PC 的 USB 口数量是有限的。

#9 楼 @wang04170 求解答,怎么远程连接 STF 啊

#10 楼 @addison 上面楼主有说了噢 ~启动 stf 的命令用 stf local --public-ip <你的 ip> ,然后就可以远程用 http://<你的 ip>:7100 来访问了

#11 楼 @wang04170 我经常看你的网易博客,能不能加个 QQ 勾搭一下 ,哈哈😄

INF/util:procutil 34132 [] Forking "/Users/allanwendy/node_modules/stf/lib/cli.js migrate"
INF/db 34133 [
] Connecting to 127.0.0.1:28015
undefined:1
ERROR: Received an unsupported protocol version. This port is for RethinkDB qu
^
SyntaxError: Unexpected token E
at Object.parse (native)
at Socket.handshake_callback (/Users/allanwendy/node_modules/stf/node_modules/rethinkdb/net.js:624:35)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)

/Users/allanwendy/node_modules/bluebird/js/main/promise.js:677
throw e;
^
ExitError: Exit code "1"
at ChildProcess. (/Users/allanwendy/node_modules/stf/lib/util/procutil.js:49:23)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074:12)

如上的问题,咋解决啊,各位

@wang04170 如上的问题,咋解决啊,帮忙看看,加不上你

16楼 已删除

#13 楼 @allanwendy rethinkdb 没启动。

#17 楼 @0x88 已经搞定了,多谢,是 stf 的问题

大东 [该话题已被删除] 中提及了此贴 06月29日 20:34
blueshark [该话题已被删除] 中提及了此贴 07月14日 14:21
匿名 #22 · 2016年07月27日

@allanwendy 请问上面的问题是怎样解决的 ?

#21 楼 @orange 换一个 stf 的版本,我的好像是

匿名 #20 · 2016年07月28日

@allanwendy 你好,初学 STF,请问怎么换版本呢,重新安装还是同样的错误,我看我的 stf 是 1.2 的

#23 楼 @orange 这个你百度一下哈

楼主好,我搭建好了环境,单台调试也正常。现在想尝试同时操作多台设备。在官网没有找到对应的资料,请问你有什么方案吗?

为啥不用 docker。。

狂师 [该话题已被删除] 中提及了此贴 10月14日 00:36
大东 [STF 系列] 无痛接入基于 LDAP 的单点登录 中提及了此贴 11月23日 11:16
blueshark STF 开发环境搭建与制作 docker 镜像过程 中提及了此贴 11月24日 14:54

为什么我最多只能 37 台,是 STF 限制,还是 ADB,有人知道吗

狂师 STF 使用系列心得 [安装篇] 中提及了此贴 12月08日 21:25

clydeiMac:~ cly$ stf doctor
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

我现在报这个错误,不知道为什么。

loneyao 回复

我现在也碰到这个问题了,不知道怎么解决,你有解决办法了吗?

linkin 回复

试了很多方法,都没解决。

loneyao 回复

我重装 node-gyp 也不行。
https://testerhome.com/topics/2988 里的 chestnut 也碰到过这个问题,不知道他解决了没有。

loneyao 回复

我用的虚拟机,全部重装了,没有再出现这个错误。
可能是之前某些步骤安装的东西版本错了吧

clydeiMac:~ cly$ stf local --public-ip 192.168.28.2 --allow-remote
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js migrate"
INF/db 10271 [
] Connecting to 127.0.0.1:28015
INF/db:setup 10271 [] Database "stf" already exists
INF/db:setup 10271 [
] Table "users" already exists
INF/db:setup 10271 [] Table "accessTokens" already exists
INF/db:setup 10271 [
] Table "vncauth" already exists
INF/db:setup 10271 [] Table "devices" already exists
INF/db:setup 10271 [
] Table "logs" already exists
INF/db:setup 10271 [] Index "users"."adbKeys" already exists
INF/db:setup 10271 [
] Index "accessTokens"."email" already exists
INF/db:setup 10271 [] Index "vncauth"."response" already exists
INF/db:setup 10271 [
] Index "vncauth"."responsePerDevice" already exists
INF/db:setup 10271 [] Index "devices"."owner" already exists
INF/db:setup 10271 [
] Index "devices"."present" already exists
INF/db:setup 10271 [] Waiting for index "users"."adbKeys"
INF/db:setup 10271 [
] Waiting for index "accessTokens"."email"
INF/db:setup 10271 [] Waiting for index "vncauth"."response"
INF/db:setup 10271 [
] Waiting for index "vncauth"."responsePerDevice"
INF/db:setup 10271 [] Waiting for index "devices"."owner"
INF/db:setup 10271 [
] Waiting for index "devices"."present"
INF/db:setup 10271 [] Index "devices"."providerChannel" already exists
INF/db:setup 10271 [
] Waiting for index "devices"."providerChannel"
INF/db:setup 10271 [] Index "users"."adbKeys" is ready
INF/db:setup 10271 [
] Index "accessTokens"."email" is ready
INF/db:setup 10271 [] Index "vncauth"."responsePerDevice" is ready
INF/db:setup 10271 [
] Index "vncauth"."response" is ready
INF/db:setup 10271 [] Index "devices"."providerChannel" is ready
INF/db:setup 10271 [
] Index "devices"."present" is ready
INF/db:setup 10271 [] Index "devices"."owner" is ready
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js triproxy app001 --bind-pub tcp://127.0.0.1:7111 --bind-dealer tcp://127.0.0.1:7112 --bind-pull tcp://127.0.0.1:7113"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js triproxy dev001 --bind-pub tcp://127.0.0.1:7114 --bind-dealer tcp://127.0.0.1:7115 --bind-pull tcp://127.0.0.1:7116"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js processor proc001 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js processor proc002 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js reaper reaper001 --connect-push tcp://127.0.0.1:7116 --connect-sub tcp://127.0.0.1:7111"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js provider --name clydeiMac.local --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.28.2 --storage-url http://localhost:7100/ --adb-host 127.0.0.1 --adb-port 5037 --vnc-initial-size 600x800 --allow-remote"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js auth-mock --port 7120 --secret kute kittykat --app-url http://192.168.28.2:7100/"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js app --port 7105 --secret kute kittykat --auth-url http://192.168.28.2:7100/auth/mock/ --websocket-url http://192.168.28.2:7110/"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js api --port 7106 --secret kute kittykat --connect-push tcp://127.0.0.1:7113 --connect-sub tcp://127.0.0.1:7111"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js websocket --port 7110 --secret kute kittykat --storage-url http://localhost:7100/ --connect-sub tcp://127.0.0.1:7111 --connect-push tcp://127.0.0.1:7113"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-temp --port 7102"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-plugin-image --port 7103 --storage-url http://localhost:7100/"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-plugin-apk --port 7104 --storage-url http://localhost:7100/"
INF/util:procutil 10270 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli.js poorxy --port 7100 --app-url http://localhost:7105/ --auth-url http://localhost:7120/ --api-url http://localhost:7106/ --websocket-url http://localhost:7110/ --storage-url http://localhost:7102/ --storage-plugin-image-url http://localhost:7103/ --storage-plugin-apk-url http://localhost:7104/"
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
FTL/cli:local 10270 [] Child process had an error ExitError: Exit code "1"
at ChildProcess. (/usr/local/lib/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
INF/cli:local 10270 [
] Shutting down all child processes
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

玄月指光 STF 折腾之路 最后换成 Docker 来安装 中提及了此贴 10月12日 16:00

这贴害人不浅啊,mac 环境都搞坏了。墙裂建议新手还是去官网

用了 sudu 就所有命令都用 不然要坑😰

匿名 #41 · 2018年07月26日

建议去官网,被这帖子坑了。各种问题

ivy520 MAC 下初次搭建 STF 一波三折 中提及了此贴 08月17日 10:25
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册