npm在mac m1 bigSur上安装opencv4nodejs错误

snvhrwxg  于 2022-11-15  发布在  Mac
关注(0)|答案(4)|浏览(254)

我一直在尝试用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 %
cedebl8k

cedebl8k1#

试着这样做
$ export OPENCV4NODEJS_DISABLE_AUTOBUILD=1
$ npm i opencv4nodejs

xzv2uavs

xzv2uavs2#

第1步:使用下面的命令在你的mac上找到opencv库的位置

find / -name "OpenCVConfig.cmake"

步骤2:提供以下路径

/opt/homebrew/Cellar/opencv/4.5.2_4/lib

步骤3:打开zshrc文件

open ~/.zshrc

步骤4:将下面的行放入zshrc文件

export OPENCV_LIB_DIR="/opt/homebrew/Cellar/opencv/4.5.2_4/lib"

步骤5:保存并关闭zshrc文件步骤6:执行以下命令

source ~/.zshrc

步骤7:现在尝试做npm i opencv 4 nodejs
干杯!干杯!

ajsxfq5m

ajsxfq5m3#

好的,我可以让opencv 4 nodejs的完整安装工作。我需要将节点从版本16降级到版本14,并做一点编译器选项挖掘!

当前设置
***macOS大苏尔***版本11.6.1
***自制***3.3.2
***开放式版本***4.5.3_2
***节点***版本14.18.1
节点安装(使用自制软件)

brew安装节点@14

opencv安装(使用自制软件)

brew安装打开

opencv 4 nodejs安装(使用节点安装程序)

  • 在安装之前,请设置以下两个编译器标志

导出CXXFLAGS="-std=c14 -Wno-c11-缩小”

  • 在设置上述环境变量的同一终端中运行安装

npm安装opencv 4 nodejs

new9mtju

new9mtju4#

我遇到了同样的问题,我确实通过以下步骤解决了这个问题。
首先所有的。我检查了npm的版本,对于这种情况我建议你更新或通过你的软件资源在下一个版本。
NodeJs 14.16.0

**NodeJ版本:14.16.0.**如果安装了另一个NodeJ版本,则可以使用此命令验证版本

node --version

Npm版本:6.4.11您需要验证是否安装了此版本,如果您有NodeJ,则可以验证此版本,但如果您没有节点,则可以安装我推荐的版本

npm --version

设置NodeJs和npm版本后,需要验证以下内容

  • 拥有visual studio 2015或最新版本的桌面组件开发
  • 已安装cmake程序
  • 有git bash
  • 拥有Java或您将使用的语言
  • 有我提到的上述程序的环境变量
    OpenCv安装

然后可以尝试再次安装open Cv
您需要重新打开另一个或新终端,然后执行以下命令

npm install --save opencv4nodejs

然后呢

npm install -g opencv4nodejs

以后比还是以前别忘了安装appium我推荐你1.19.1版
您可以验证您是否有appium with opencv with open Cv doctor,您可以运行appium-doctor并检查是否存在Open cv组件。
要安装appium doctor,您可以运行以下命令:npm install -g appium-doctor
我希望这些答案对您有所帮助
作者:埃德·卡波诺罗

相关问题