C++ 如何安装opencv4nodejs模块

C++ 如何安装opencv4nodejs模块,c++,node.js,opencv,npm,cmake,C++,Node.js,Opencv,Npm,Cmake,嗨,我正试图在Node.js项目中使用opencv,所以我决定使用opencv4nodejs。我试图通过npm安装此模块,发现了一些与计算机上缺少cmake相关的错误。因此,我决定通过brew安装cmake。但在此过程之后,当我尝试安装此模块时,会出现以下错误: MacBook-Air-Micha:webcam-myidea michalkukielka$ npm install opencv4nodejs > opencv-build@0.1.8 install /Users/mich

嗨,我正试图在Node.js项目中使用opencv,所以我决定使用
opencv4nodejs
。我试图通过
npm
安装此模块,发现了一些与计算机上缺少
cmake
相关的错误。因此,我决定通过
brew
安装
cmake
。但在此过程之后,当我尝试安装此模块时,会出现以下错误:

MacBook-Air-Micha:webcam-myidea michalkukielka$ npm install opencv4nodejs

> opencv-build@0.1.8 install /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build
> node ./install.js

info No package.json in folder. 
info install if you want to use an own OpenCV installation set OPENCV4NODEJS_DISABLE_AUTOBUILD
info readAutoBuildFile file does not exists: /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json
info install failed to find auto-build.json: /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/auto-build.json
info install 
info install running install script...
info install 
info install opencv version: 3.4.6
info install with opencv contrib: yes
info install custom build flags: 
info install 
info install executing: git --version
info install git --version: git version 2.20.1
info install 
info install executing: cmake --version
info install cmake --version: cmake version 3.15.3
info install 
info install CMake suite maintained and supported by Kitware (kitware.com/cmake).
info install 
info install installing opencv version 3.4.6 into directory: /Users/michalkukielka/Documents/webcam-myidea/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.
remote: Total 2160 (delta 365), reused 1101 (delta 134), pack-reused 0
Receiving objects: 100% (2160/2160), 50.82 MiB | 1.57 MiB/s, done.
Resolving deltas: 100% (365/365), done.
Note: checking out 'f26c98365da6af93cb5e49397b571190fca7bb55'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

Checking out files: 100% (1780/1780), done.
Cloning into 'opencv'...
remote: Enumerating objects: 7328, done.
remote: Counting objects: 100% (7328/7328), done.
remote: Compressing objects: 100% (6260/6260), done.
remote: Total 7328 (delta 1166), reused 3907 (delta 692), pack-reused 0
Receiving objects: 100% (7328/7328), 81.33 MiB | 1.62 MiB/s, done.
Resolving deltas: 100% (1166/1166), done.
Note: checking out '33b765d7979fd8a6038026aa44f6ff1a9c082b7b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

Checking out files: 100% (6080/6080), done.
info install running cmake /Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/opencv,-DCMAKE_INSTALL_PREFIX=/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build,-DCMAKE_BUILD_TYPE=Release,-DBUILD_EXAMPLES=OFF,-DBUILD_DOCS=OFF,-DBUILD_TESTS=OFF,-DBUILD_PERF_TESTS=OFF,-DBUILD_JAVA=OFF,-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr,-DBUILD_opencv_apps=OFF,-DBUILD_opencv_aruco=OFF,-DBUILD_opencv_bgsegm=OFF,-DBUILD_opencv_bioinspired=OFF,-DBUILD_opencv_ccalib=OFF,-DBUILD_opencv_datasets=OFF,-DBUILD_opencv_dnn_objdetect=OFF,-DBUILD_opencv_dpm=OFF,-DBUILD_opencv_fuzzy=OFF,-DBUILD_opencv_hfs=OFF,-DBUILD_opencv_java_bindings_generator=OFF,-DBUILD_opencv_js=OFF,-DBUILD_opencv_img_hash=OFF,-DBUILD_opencv_line_descriptor=OFF,-DBUILD_opencv_optflow=OFF,-DBUILD_opencv_phase_unwrapping=OFF,-DBUILD_opencv_python3=OFF,-DBUILD_opencv_python_bindings_generator=OFF,-DBUILD_opencv_reg=OFF,-DBUILD_opencv_rgbd=OFF,-DBUILD_opencv_saliency=OFF,-DBUILD_opencv_shape=OFF,-DBUILD_opencv_stereo=OFF,-DBUILD_opencv_stitching=OFF,-DBUILD_opencv_structured_light=OFF,-DBUILD_opencv_superres=OFF,-DBUILD_opencv_surface_matching=OFF,-DBUILD_opencv_ts=OFF,-DBUILD_opencv_xobjdetect=OFF,-DBUILD_opencv_xphoto=OFF,-DWITH_VTK=OFF,-DOPENCV_ENABLE_NONFREE=ON,-DOPENCV_EXTRA_MODULES_PATH=/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/opencv_contrib/modules
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
CMake Error at CMakeLists.txt:153 (message):
  CMake fails to determine the bitness of the target platform.

    Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.


-- Configuring incomplete, errors occurred!
See also "/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/Users/michalkukielka/Documents/webcam-myidea/node_modules/opencv-build/opencv/build/CMakeFiles/CMakeError.log".
ERR! child process exited with code 1 (for more info, set '--loglevel silly') 

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build@0.1.8 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the opencv-build@0.1.8 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/michalkukielka/.npm/_logs/2019-09-07T05_38_02_479Z-debug.log
MacBook Air Micha:webcam myidea michalkukielka$npm安装opencv4nodejs
>opencv-build@0.1.8安装/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build
>node./install.js
文件夹中的info No package.json。
如果您想使用自己的OpenCV安装集OPENCV4NODEJS\u DISABLE\u AUTOBUILD,请安装信息
info readAutoBuildFile文件不存在:/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv/auto-build.json/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv/auto-build.json
info install未能找到auto-build.json:/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv/auto-build.json
信息安装
信息安装正在运行安装脚本。。。
信息安装
信息安装opencv版本:3.4.6
使用opencv contrib安装信息:是
信息安装自定义生成标志:
信息安装
正在执行的信息安装:git--版本
信息安装git--版本:git版本2.20.1
信息安装
信息安装:cmake--版本
信息安装cmake--版本:cmake版本3.15.3
信息安装
信息安装Kitware(Kitware.com/CMake)维护和支持的CMake套件。
信息安装
信息安装将opencv版本3.4.6安装到目录:/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv
克隆到“opencv_contrib”。。。
远程:枚举对象:2160,完成。
远程:计数对象:100%(2160/2160),完成。
远程:压缩对象:100%(1916/1916),完成。
远程:总计2160(增量365),重复使用1101(增量134),包重复使用0
接收对象:100%(2160/2160),50.82 MiB | 1.57 MiB/s,完成。
解析增量:100%(365/365),完成。
注意:正在查看“f26c98365da6af93cb5e49397b571190fca7bb55”。
你处于“超脱的头部”状态。你可以四处看看,做实验
更改并提交它们,您可以放弃在此过程中所做的任何提交
通过执行另一个签出,在不影响任何分支的情况下进行状态设置。
如果要创建新分支以保留创建的提交,可以
再次将-b与checkout命令一起使用(现在或以后)。例子:
git签出-b
签出文件:100%(1780/1780),完成。
克隆到“opencv”。。。
远程:枚举对象:7328,完成。
远程:计数对象:100%(7328/7328),完成。
远程:压缩对象:100%(6260/6260),完成。
远程:共7328个(增量1166),重复使用3907个(增量692),包重复使用0个
接收对象:100%(7328/7328),81.33 MiB | 1.62 MiB/s,完成。
解析增量:100%(1166/1166),完成。
注意:查看“33b765d7979fd8a6038026aa44f6ff1a9c082b7b”。
你处于“超脱的头部”状态。你可以四处看看,做实验
更改并提交它们,您可以放弃在此过程中所做的任何提交
通过执行另一个签出,在不影响任何分支的情况下进行状态设置。
如果要创建新分支以保留创建的提交,可以
再次将-b与checkout命令一起使用(现在或以后)。例子:
git签出-b
签出文件:100%(6080/6080),完成。
信息安装运行cmake/Users/michalkukielka/Documents/webcam myidea/node\u modules/opencv build/opencv/opencv,-DCMAKE\u install\u PREFIX=/Users/michalkukielka/Documents/webcam myidea/node\u modules/opencv build/opencv/build,-\u build\u实例=OFF,--DBUILD\u DOCS=OFF,--DBUILD\u测试=OFF,--DBUILD\u性能测试=OFF,-,--DBUILD\u JAVA=OFF,-DCUDA\u NVCC\u FLAGS=--expt relaxed constexpr,-DBUILD\u opencv\u apps=OFF,-DBUILD\u aruco=OFF,-DBUILD\u opencv\u biospired=OFF,-DBUILD\u opencv\u ccalib=OFF,-DBUILD\u opencv\u dataset=OFF,-DBUILD\u opencv\u dn\u obetect=OFF,-DBUILD\u opencv\u dpm=OFF-DBUILD\u opencv=OFF\u模糊=OFF,--DBUILD\u-opencv=OFF=OFF,-DBUILD\u opencv\u js=OFF、-DBUILD\u opencv\u img\u hash=OFF、-DBUILD\u opencv\u optflow=OFF、-DBUILD\u opencv\u phase\u unwrapping=OFF、-DBUILD\u opencv\u python3=OFF、-DBUILD\u opencv\u python\u绑定生成器=OFF、-DBUILD\u opencv\u reg=OFF、-DBUILD\u opencv=OFF,-DBUILD\u opencv\u缝合=关闭,-DBUILD\u opencv\u结构化光=关闭,-DBUILD\u opencv\u superres=关闭,-DBUILD\u opencv\u曲面匹配=关闭,-DBUILD\u opencv\u xobjdetect=关闭,-DBUILD\u opencv\u xphoto=关闭,-DWITH VTK=关闭,-DOPENCV ENABLE\u NONFREE=打开,-DOPENCV_EXTRA_MODULES_PATH=/Users/michalkukielka/Documents/webcam myidea/node_MODULES/opencv build/opencv/opencv_contrib/MODULES
--CXX编译器标识未知
--C编译器标识未知
--检查CXX编译器是否工作:/usr/bin/c++
--检查CXX编译器是否正常工作:/usr/bin/c++--正常工作
--检测CXX编译器ABI信息
--检测CXX编译器ABI信息-失败
--检查C编译器是否工作:/usr/bin/cc
--检查C编译器是否工作:/usr/bin/cc--works
--检测C编译器ABI信息
--检测C编译器ABI信息-失败
CMakeLists.txt:153处的CMake错误(消息):
CMake无法确定目标平台的比特数。
请检查您的CMake和编译器安装。如果是交叉编译,请确保CMake工具链文件正确设置编译器详细信息。
--配置不完整,出现错误!
另请参见“/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv/build/CMakeFiles/CMakeOutput.log”。
另请参见“/Users/michalkukielka/Documents/webcam myidea/node_modules/opencv build/opencv/build/CMakeFiles/CMakeError.log”。
犯错误子进程已退出,代码为1(有关详细信息,请设置'--loglevel')
npm错误!代码失效循环
npm错误!错误1
npm install --global windows-build-tools
cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ ...
brew update
brew install opencv@4
brew link --force opencv@4