node.js - 在 mac m1 bigSur 上 npm 安装 opencv4nodejs 错误
问题描述
我一直在尝试使用npm install opencv4nodejs
命令安装 opencv4nodejs 包。但不幸的是,下面的内容被抛出。做了一些研究并做了一些调整,但所有这些都不起作用。
以下是错误:
manikanthvanka@Manikanths-MacBook-Pro react-file-upload-master % npm install opencv4nodejs
> opencv-build@0.1.9 install /Users/manikanthvanka/Downloads/react-
file-upload-master/node_modules/opencv-build
> node ./install.js
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...
> opencv4nodejs@5.6.0 install /Users/manikanthvanka/Downloads/react-
file-upload-master/node_modules/opencv4nodejs
> node ./install/install.js
info install OPENCV_LIB_DIR is not set, looking for default lib dir
info install using lib dir: /usr/local/lib
/Users/manikanthvanka/Downloads/react-file-upload-
master/node_modules/opencv4nodejs/install/install.js:45
throw new Error('no OpenCV libraries found in lib dir: ' + libDir)
^
Error: no OpenCV libraries found in lib dir: /usr/local/lib
at Object.<anonymous> (/Users/manikanthvanka/Downloads/react-file-
upload-master/node_modules/opencv4nodejs/install/install.js:45:9)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
npm WARN @tinymce/tinymce-react@3.10.2 requires a peer of
react@^17.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN @tinymce/tinymce-react@3.10.2 requires a peer of react-
dom@^17.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN bootstrap@4.6.0 requires a peer of jquery@1.9.1 - 3 but
none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.6.0 requires a peer of popper.js@^1.16.1 but n.
one is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >=
3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >=
3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none
is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv4nodejs@5.6.0 install: `node ./install/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv4nodejs@5.6.0 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/manikanthvanka/.npm/_logs/2021-03-
07T11_03_42_873Z-debug.log
manikanthvanka@Manikanths-MacBook-Pro react-file-upload-master %
解决方案
好的,所以我能够完全安装 opencv4nodejs 工作。我需要将节点从版本 16 降级到版本 14 并做一些编译器选项挖掘!
当前设置
macOS Big Sur v11.6.1
Homebrew 3.3.2
opencv 4.5.3_2
节点v14.18.1
节点安装(使用 Homebrew)
brew install node@14
opencv 安装(使用 Homebrew)
brew install opencv
opencv4nodejs 安装(带有节点安装程序)
- 在安装之前设置以下两个编译器标志
export CXXFLAGS="-std=c++14 -Wno-c++11-narrowing" - 在您设置上述环境变量的同一终端中运行安装
npm install opencv4nodejs
推荐阅读
- jenkins - java.io.NotSerializableException: org.yaml.snakeyaml.Yaml
- c++ - 单个屏幕内的多个桌面
- python - opencv提取激光线
- python - How to convert integer numbers read from a text file and store as a binary file having 16bit integers?
- c# - Newtonsoft.Json 版本 12.0.0.0 引发 Hashtable 序列化异常
- amazon-web-services - DynamoDB - AWS 上的事件存储
- sqlite - 如何解决 SQLite 错误 5:数据库被锁定?
- c++ - 在记录集 ADO 中找不到记录
- c# - 如何实现一个支持异步方法的类?
- google-data-studio - Google Data Studio 用于多租户 SaaS 应用程序的可行性