文章格式并不規(guī)范育叁,其實(shí)只是為了做個(gè)記錄迅脐,記錄自己在搭建stf環(huán)境的時(shí)候所遇到各種坑,貌似一個(gè)簡(jiǎn)單的環(huán)境搭建豪嗽,前前后后差不多五天時(shí)間谴蔑。豌骏。。真心快崩潰了隐锭。對(duì)于真正搭建過此環(huán)境的人來說窃躲,可能會(huì)有借鑒作用吧,至于沒接觸過的童鞋钦睡,用處不大蒂窒,建議就不要往下看了,就是這么任性~~~~
各種工具的下載安裝:
1.安裝xcode和xcode命令行工具(已有未驗(yàn)證這步)
Xcode:直接在 App Store 下載安裝
Xcode Command Line Tools:在terminal中輸入以下命令荞怒,然后在彈出的安裝步驟中猛點(diǎn)下一步自動(dòng)安裝洒琢。
xcode-select --install
2.安裝MacPorts,后面會(huì)用到port(參照MacPorts的安裝)
3.SDK環(huán)境安裝—已有褐桌,忽略衰抑。
4.nodejs的安裝 — 已有,忽略荧嵌。
[https://nodejs.org/en/](https://nodejs.org/en/)
驗(yàn)證:
node -v
v6.11.0
5.安裝bower:
sudo npm install bower -g
驗(yàn)證:
bower -v
6.安裝rethinkdb(這里建議通過pgk安裝)
[rethinkdb](https://www.rethinkdb.com/docs/install/)
7.安裝graphicsmagick
do port install graphicsmagick
8.安裝libsodium
sudo port install libsodium
9.安裝zeromp
sudo port install zmq
10.安裝protobuf
sudo port install protobuf-cpp
11.安裝pkg-config
sudo port install pkgconfig
12.安裝stf
sudo npm install -g stf
后續(xù)有報(bào)錯(cuò):
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/stf -> /usr/local/lib/node_modules/stf/bin/stf
> dtrace-provider@0.8.3 install /usr/local/lib/node_modules/stf/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js
> dtrace-provider@0.7.1 install /usr/local/lib/node_modules/stf/node_modules/dtrace-provider
> node scripts/install.js
> bufferutil@1.3.0 install /usr/local/lib/node_modules/stf/node_modules/bufferutil
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zrck/.node-gyp/6.10.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/stf/node_modules/bufferutil/.node-gyp"
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
> jpeg-turbo@0.4.0 install /usr/local/lib/node_modules/stf/node_modules/jpeg-turbo
> node-pre-gyp install --fallback-to-build
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zrck/.node-gyp/6.10.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/.node-gyp"
make: *** No rule to make target `../.node-gyp/6.10.2/include/node/common.gypi', needed by `Makefile'. Stop.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64/jpegturbo.node" "--module_name=jpegturbo" "--module_path=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64"
gyp ERR! cwd /usr/local/lib/node_modules/stf/node_modules/jpeg-turbo
gyp ERR! node -v v6.10.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64/jpegturbo.node --module_name=jpegturbo --module_path=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:886:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Darwin 16.3.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/stf/node_modules/jpeg-turbo
node-pre-gyp ERR! node -v v6.10.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.19
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64/jpegturbo.node --module_name=jpegturbo --module_path=/usr/local/lib/node_modules/stf/node_modules/jpeg-turbo/lib/binding/node-v48-darwin-x64' (1)
/usr/local/lib
└── (empty)
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "stf"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
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'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the jpeg-turbo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs jpeg-turbo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls jpeg-turbo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/zrck/npm-debug.log
npm ERR! code
嘗試解決:
https://testerhome.com/topics/2988
https://github.com/node-inspector/v8-debug/issues/7
http://blog.csdn.net/qq_26819733/article/details/55549241?locationNum=11&fps=1
https://testerhome.com/topics/5206
最后 重裝nodejs (采用官網(wǎng)pkg下載安裝)
bogon:~ zrck$ node -v
v8.1.2
bogon:~ zrck$ npm -v
5.0.3
之后繼續(xù)嘗試安裝
sudo npm install -g stf
貌似正常了 呛踊,但后來一直死循環(huán)一般的提示:
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/stf/node_modules/zmq/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/stf/node_modules/zmq/.node-gyp"
字面意思應(yīng)該是沒有root權(quán)限操作,嘗試:
sudo chmod -R 777 /var/root
然后繼續(xù)重試:sudo npm install -g stf 成功
sudo npm install -g stf
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/stf -> /usr/local/lib/node_modules/stf/bin/stf
+ stf@2.3.0
updated 1 package in 30.743s
題外Tip:可能還會(huì)有一種可能造成無權(quán)限完丽,是蘋果系統(tǒng)自帶的SIP安全機(jī)制
OS X El Capitan 中有一個(gè)跟安全相關(guān)的模式叫 SIP(System Integrity Protection )恋技,它禁止讓軟件以 root 身份來在 Mac 上運(yùn)行,在升級(jí)到 OS X 10.11 中或許你就會(huì)看到部分應(yīng)用程序被禁用了逻族,這些或許是你通過終端或者第三方軟件源安裝蜻底。對(duì)于大多數(shù)用戶來說,這種安全設(shè)置很方便聘鳞,但是也有些開發(fā)者或者高級(jí) Mac 用戶不需要這樣的設(shè)置,關(guān)閉方法:
1.重啟 Mac薄辅,按住 Command+R 鍵直到 Apple logo 出現(xiàn),進(jìn)入 Recovery Mode
2.點(diǎn)擊 Utilities > Terminal
3.在 Terminal 中輸入 csrutil disable抠璃,之后回車
》》》重啟 Mac
但可以看到 上面有一個(gè)警告:
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
搜了下解決辦法:
google了下有網(wǎng)友給出的答案是:the node-uuid module deprecated,u need to install uuid module.
npm install -g uuid
或者
npm uninstall --save node-uuid
npm install --save uuid
依舊無效站楚,但不影響stf的安裝,選擇忽略了搏嗡。
運(yùn)行時(shí)報(bào)錯(cuò):
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^
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.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
項(xiàng)目GitHub里issues里有相關(guān)問題解決方案窿春,作者建議的是將nodejs升級(jí)到最新版本,重試之后 依舊存在問題采盒。
后來懷疑是nodejs或者stf在安裝時(shí)丟文件導(dǎo)致旧乞,試了下淘寶鏡像
https://npm.taobao.org/package/stf
執(zhí)行命令來全局安裝cnpm
npm install -g cnpm --registry=[https://registry](https://registry).[npm.taobao.org](http://npm.taobao.org)
cnpm install stf -g
。磅氨。尺栖。。烦租⊙佣模看到了曙光除盏,進(jìn)入了stf的管理頁(yè)面終于打開了。
悲催的是 無法正常連接設(shè)備挫以。
看提示感覺像是jpeg-turbo安裝有問題:
npm install jpeg-turbo --registry=https://registry.npm.taobao.org
但依舊無效果
最后者蠕,重新將nodejs卸載,stf卸載屡贺,nodejs采用資源文件編譯安裝蠢棱,stf 通過:npm install stf -g安裝,成功進(jìn)入網(wǎng)頁(yè)甩栈,連接魅族note2手機(jī)無法連接:
Starting service: Intent { cmp=jp.co.cyberagent.stf/.Service } Error: Not found; no service started.
目前未能找到有效的解決辦法泻仙。
其他設(shè)備:華為G750連接成功,手頭一臺(tái)android版pos設(shè)備連接成功量没。