在搭建stf过程中遇到了很多问题,耗费了不少时间,希望这篇文章能给大家提供帮助。
mac搭建stf教程指路Mac搭建stf教程-2023_Vermouth_00的博客-CSDN博客
目录
1.安装nvm前需要保证电脑上没有node和npm,mac如何彻底卸载node
2.执行sudo npm uninstall npm -g,提示env: node: No such file or directory
3.安装配置nvm时,在根目录下.bash_profile中加了环境变量,执行nvm命令还是失败,提示:nvm: command not found
4.安装rethinkdb时报错:Error: rethinkdb: no bottle available
6.配置环境变量,操作.bash_profile时报错:Found a swap file by the name ".bash_profile.swp"
9.执行stf doctor,提示command not found
10.执行stf doctor,提示lazy symbol binding failed: Symbol not found: _zmq_version
1.安装nvm前需要保证电脑上没有node和npm,mac如何彻底卸载node
参考文档:https://blog.csdn.net/huangpb123/article/details/120248002
sudo npm uninstall npm -g
brew uninstall node
如果电脑上还有.npm文件夹,则执行sudo rm -rf ~/.npm
验证卸载成功:
node #提示command not found
npm #提示command not found
2.执行sudo npm uninstall npm -g,提示env: node: No such file or directory
可能是因为先卸载了node再执行这个命令,就会提示没有node这个文件了;
可以尝试手动把.npm文件删了
sudo rm -rf ~/.npm
3.安装配置nvm时,在根目录下.bash_profile中加了环境变量,执行nvm命令还是失败,提示:nvm: command not found
要把nvm加入shell中,就可以在terminal中直接使用;
$ echo "source $(brew --prefix nvm)/nvm.sh" >> .bash_profile 或者把这句加入环境变量
$ . ~/.bash_profile
$ nvm --version #查看nvm版本
4.安装rethinkdb时报错:Error: rethinkdb: no bottle available!
解决方案:执行以下命令,然后再次安装即可;
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
brew update
5.启动rethinkdb失败,8080端口被占用
rethinkdb --port-offset 3 -d data/
-d 会在当前路径下有个data文件夹存放数据
rethinkdb服务默认的管理页面http服务占用8080端口,但是很多时候我们的8080端口会被别的应用占用,则可以指定这个参数,端口号偏移量;
6.配置环境变量,操作.bash_profile时报错:Found a swap file by the name ".bash_profile.swp"
对bash_profile文件操作时异常退出,这会导致系统创建一个bash_profile.swp文件
解决办法:
-
输入 q(退出)
-
然后在终端出入:rm -f ~/.bash_profile.swp
-
最后你在终端输入 source ~/.bash_profile就可以了
7.执行npm install -g stf出现error
bufferutil依赖安装报错,单独安装这个依赖;
8.将未安装成功的依赖重新安装后,stf还是没有成功安装
可以尝试使用v8.14.0的node安装stf,能够安装成功。
9.执行stf doctor,提示command not found
这个是因为关闭终端重新打开之后,默认的node版本变成了8.17,而stf是基于8.14版本node安装的;
nvm use 8.14
切换到8.14版本node后,再执行stf doctor即可;
10.执行stf doctor,提示lazy symbol binding failed: Symbol not found: _zmq_version
这个在网上找了很多解决办法,主要是单独安装zmq,但是我单独安装zmq,以及配置zmq环境变量,stf doctor还是会有这个提示;
发现有很多m1芯片的电脑会有这个问题,intel芯片的电脑没问题;
一个解决方案是安装新的stf即devicefarmer stf;
GitHub - DeviceFarmer/stf: Control and manage Android devices from your browser.