【Mac OS X】brew: command not found
ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
macOS 安装 adb
通过 homebrew 安装
brew cask install android-platform-tools
<!--more-->
测试是否正常
adb devices
手动安装
# 移除老的安装包
rm -rf ~/.android-sdk-macosx/
# 下载 sdk
# 下载地址:developer.android.com
# 将下载的文件解压并移动到 ~/.android-sdk-macosx
cd ~/Downloads(你的下载目录)/
unzip android-sdk*.zip
mv android-sdk-macosx/ ~/.android-sdk-macosx
# 运行 SDK Manager sh ~/.android-sdk-macosx/tools/android # 根据你的需要选择,(我只需要Android SDK Platform-tools)[可选步骤] # 选好后 Install #环境变量设置 echo 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile # 更新配置文件 source ~/.bash_profile # 测试是否正常安装 adb devices
安装
参照 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
至于怎么按准过老版本的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! bufferutil@1.3.0 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bufferutil@1.3.0 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
无报错,则说明安装成功
运行
安装成功后,启动stf
rethinkdb
stf local
本地浏览器输入
localhost:7100
登录后出现如下界面
至此,stf在mac上安装算是完成。