MAC下STF安装及踩坑

关于stf的介绍,我就不多说了,懂的人自然懂。

之前实践过在centos7上安装stf,踩了不少坑,最近换了在Mac上安装也踩了几个小坑,记录一下。赠人玫瑰,手留余香。希望能够帮到有同样坑的人。

安装

参照 github 上的教程,总体分两步,说起来很容易
首先检查一下基本的环境

node -v
npm -v
java -version
adb version

如果以上四点均OK了,那么可以开始下面
第一步

brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config

第二步

npm install -g stf

至此,理想情况下stf就应该安装成功了。
但是总会遇到一些坑。

踩坑

node版本问题

一般安装node,都是直接brew 安装的

brew install node

这边默认安装的版本比较高,而stf对node的最新版本没有做到完美兼容,所以我们需要安装旧版本的node,以8.x为佳

在github上看,很多人题给作者的问题,作者也会回复了,建议使用8.x


MAC下STF安装及踩坑_第1张图片
node version.png

至于怎么按准过老版本的node,建议使用nvm
具体怎么用,我参考的是这篇文章

报错[email protected] install: node-gyp rebuild

我在安装过程中主要是遇到这个问题,报错如下:

gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/dongshichao/.nvm/versions/node/v8.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/dongshichao/.nvm/versions/node/v8.11.0/bin/node" "/Users/dongshichao/.nvm/versions/node/v8.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/dongshichao/.nvm/versions/node/v8.11.0/lib/node_modules/stf/node_modules/bufferutil
gyp ERR! node -v v8.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dongshichao/.npm/_logs/2018-12-17T15_00_38_264Z-debug.log

我一开始node版本是10.x,后来安装报上面的错
后来我在github上看到作者给别人的回复,建议使用8.x,我刚换8.11后问题依然存在。
后来又安装8.14,使用8.14安装成功
最终,我的版本是

dongshichaodeMacBook-Pro:~ dongshichao$ node -v
v8.14.0
dongshichaodeMacBook-Pro:~ dongshichao$ npm -v
6.4.1

踩完这两个坑,输入

stf doctor

无报错,则说明安装成功


MAC下STF安装及踩坑_第2张图片
stfdoctor.png

运行

安装成功后,启动stf

rethinkdb
stf local

本地浏览器输入

localhost:7100

登录后出现如下界面


MAC下STF安装及踩坑_第3张图片
devices.png

至此,stf在mac上安装算是完成。

你可能感兴趣的:(MAC下STF安装及踩坑)