安装教程可以参考我之前写的,这里不再多说,直接说问题。
安装完成后输入stf doctor查看工具依赖是否正确
问题1:Unexpected error checking ZeroMQ: Error: Module version mismatch. Expected 48, got 47.
问题分析:根据错误提示,初步定位node moudle的版本不一致,期望的是48,而我的node moudle 是47.于是进入node官网(https://nodejs.org/en/download/releases/)下载moudle 等于48的nodejs版本。
node moudle version 可以根据下图中红框一列来确定自己所需要的版本。
解决方法:将v5.x版本升级到v6.x后,再次运行stf doctor,该问题解决。又出现问题2。
ps:问题灵感源:https://github.com/nodejs/node/wiki/Breaking-changes-between-v6-and-v7
Native Modules (Addons)
- The Native Module version mismatch error has been updated to be far more clear.
- Refs: [
1fda657cac
], #8391
- Refs: [
Previously:
Module version mismatch. Expected 51, got 48.
Now:
The module '<module>'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 51. Please try re-compiling or Re-installing
the module (for instance, using `npm rebuild` or `npm install`).
- The
NODE_MODULE_VERSION
is now51
.- Refs: [
96933df2ff
], #8808
- Refs: [
问题2:Error: The module '/usr/local/lib/node_modules/stf/node_modules/_zmq@2.15.3@zmq/build/Release/zmq.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 47. This version of Node.js requires NODE_MODULE_VERSION 57. Please try re-compiling or re-installing the module
问题分析:在GitHub上看到外国友人这么说的:
大概是说在安装某个依赖应用中,我们升级或者安装了其他版本的node版本导致安装应用时所使用node版本与我们变更后当前的node版本不一致。
解决方法:根据错误提示建议,及国外友人建议,执行npm install 或 npm rebuild去重新构建node,注意:执行npm install / npm rebuild命令必须进入stf根目录执行
问题3:
scripts.prepublish: "bower install --allow-root && not-in-install && gulp build || in-install"
(node:1305) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
module.js:442
throw err;
^
Error: Cannot find module 'strip-json-comments'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/root/stf-master/node_modules/.npminstall/eslint/2.13.0/eslint/lib/config/config-file.js:23:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
Error: Run "sh -c bower install --allow-root && not-in-install && gulp build || in-install" error, exit code 1
Error: Run "sh -c bower install --allow-root && not-in-install && gulp build || in-install" error, exit code 1
at ChildProcess.proc.on.code (/usr/lib/node_modules/cnpm/node_modules/runscript/index.js:67:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
解决方法:参考 https://toutiao.io/posts/9kf4j3/preview 方可解决
问题4:插入手机后,STF显示手机信息但一直处于disconnect状态,刷新页面后,手机设备信息全部消失。查看stf控制台输出,如下:
FTL/util:lifecycle 7678 [5e56e8f2] Shutting down due to fatal error
INF/provider 6994 [*] Cleaning up device worker "5e56e8f2"
ERR/provider 6994 [*] Device worker "5e56e8f2" died with code 1
npm ERR! jpeg-turbo@0.4.0 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jpeg-turbo@0.4.0 install script 'node-pre-gyp install --fallback-to-build'.
解决方法:
1、install yams, run brew install yasm
2、At last run cnpm install -g stf