mac下搭建openstf環境
STF是WEB 端批量移動設備管理控制工具,全名Smartphone Test Farm,可以提供遠程真機使用調試的功能,已有的云真機平臺大多通過STF實現,目前僅支持Android設備,項目地址:https://openstf.github.io/
安裝過程
1.安裝node.js
brew install node
- 安裝Android-SDK和java
注意設置環境變量,建議直接安裝Android Studio - 安裝 rethinkdb
brew install rethinkdb
- 安裝 graphicsmagick
brew install graphicsmagick
- 安裝 zeromq
brew install zeromq
- 安裝protobuf
brew install protobuf
- 安裝pkg-config
brew install pkg-config
- 安裝yasm
brew install yasm
- 安裝bower
安裝前可先將npm 配置項registry修改為淘寶鏡像,外國鏡像下載較慢可能出問題
npm config set registry https://registry.npm.taobao.org
然后安裝bower
npm install bower -g
10.安裝STF
npm install -g stf
11.全部裝完之后檢查環境配置
stf doctor
(不報錯即可,報錯按照錯誤提示解決)
啟動服務
1.啟動rethinkDB
rethinkdb
- 啟動stf服務端
本地啟動:
stf local
指定ip和允許遠程連接啟動:
stf local --public-ip 10.10.8.18 --allow-remote
啟動后在瀏覽器中輸入對應地址http://10.10.8.18:7100/,登錄頁面的用戶名和郵箱隨便輸入,啟動后頁面如下:
QQ20191129-174312.png
安裝中遇到的問題
Unexpected token ...
2019-11-29T08:15:59.988Z FTL/cli:local 82786 [*] Child process had an error ExitError: Exit code "1"
at ChildProcess.<anonymous> (/usr/local/Cellar/node/13.2.0/lib/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
解決方法:
node.js通過n模塊安裝多個版本,安裝完后切換到8.11版本
npm install -g n //安裝n模塊
n 8.11 //安裝node.js8.11版本(支持8.x版本,但是作者開始用8.0一直報以上錯誤)
n //查看已安裝版本,可以上下鍵切換,回車選擇
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.nodeat bindings
解決方法:
卸載stf、zeromq,重新安裝重新安裝zeromq、stf,最好不要用sudo,用sudo可能會出問題,如果遇到權限訪問問題,可以通過chmod 777修改文件夾權限
sudo chmod 777 -R 文件夾路徑
WARN EACCES user "root" does not have permission to access the dev dir
解決方法:
沒有文件夾的訪問權限,可以通過chmod 777修改文件夾權限
sudo chmod 777 -R 文件夾路徑
xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools'
is a command line tools instance
解決方法:
xcodebuild的路徑不正確,將路徑切換到Xcode的目錄下:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
- npm報錯
error code EINTEGRITY
解決方法:
升級npm
npm i -g npm
刪除package-lock.json
刪除緩存目錄下的所有數據
npm cache clean –force
驗證緩存數據的有效性和完整性,清理垃圾數據
npm cache verify