背景,安装appium后,appium-doctor检查,提示:opencv4nodejs没有找到,于是执行
npm i -g opencv4nodejs
安装失败,失败内容如下:
info install installing opencv version 3.4.6 into directory: /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv
Cloning into 'opencv_contrib'...
remote: Enumerating objects: 2160, done.
remote: Counting objects: 100% (2160/2160), done.
remote: Compressing objects: 100% (1916/1916), done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
ERR! child process exited with code 128 (for more info, set '--loglevel silly')
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build@0.1.9 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build@0.1.9 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! xxxxxxx-debug.log
查阅相关博客,
关于设置git的操作:
git config --global http.postBuffer 524288000 //增大git缓存
git config --global https.postBuffer 524288000 //增大git缓存
设置后依然抱错。
有人说执行:
brew unlink tesseract // 如果没有tesseract可以忽略这个命令
执行后依然安装失败。
后来,有人说要
brew install opencv@4
如此安装后,appium-doctor检查还是不能发现opencv4nodejs。
后来有人说要:
export OPENCV4NODEJS_DISABLE_AUTOBUILD=1
npm i -g opencv4nodejs
执行后,安装成功。
问题困扰了好几天,总算解决。
参考How to install:
https://github.com/justadudewhohacks/opencv4nodejs