[英]Cannot find module '../build/Release/opencv4nodejs
I am new to OpenCV and node.js, trying to learn OpenCV in node.js.我是OpenCV和node.js的新手,想在node.js学习OpenCV。
I came across opencv4nodejs which I found best for learning.我遇到了opencv4nodejs ,我发现它最适合学习。
I have followed all steps to install OpenCV and setting environment variables for OpenCV and done npm install opencv4nodejs
also.我已按照所有步骤安装 OpenCV 并为 OpenCV 设置环境变量,并完成
npm install opencv4nodejs
。 able to run Quick start code given but when I try to run example machineLearningOCR.js from examples folder I get error Error: Cannot find module '../build/Release/opencv4nodejs'
能够运行给定的快速启动代码但是当我尝试从示例文件夹运行示例 machineLearningOCR.js 时出现错误
Error: Cannot find module '../build/Release/opencv4nodejs'
I run command node machineLearningOCR.js
from cmd but getting error mentioned above on line const cv = require('../');
我从 cmd 运行命令
node machineLearningOCR.js
但在const cv = require('../');
行出现上述错误
How to run examples given in opencv4nodejs?如何运行opencv4nodejs中给出的示例?
If you cloned the repository and want to use the examples directly from the examples folder then you have to npm install
in the root directory first to build the module.如果您克隆了存储库并希望直接从示例文件夹中使用示例,那么您必须首先在根目录中进行
npm install
以构建模块。
Optionally you can npm install opencv4nodejs
in any project directory, copy the examples into that directory and replace const cv = require('../');
或者,您可以在任何项目目录中
npm install opencv4nodejs
,将示例复制到该目录并替换const cv = require('../');
with const cv = require('opencv4nodejs');
使用
const cv = require('opencv4nodejs');
. .
You can also directly submit an issue here: https://github.com/justadudewhohacks/opencv4nodejs/issues你也可以在这里直接提交问题: https : //github.com/justadudewhohacks/opencv4nodejs/issues
I had the same problem and I did solve the issue with the following steps.我有同样的问题,我确实通过以下步骤解决了问题。
First all of.首先所有的。 I checked the npm version, for this case I recommend you updated or pass your software resources at the next version.
我检查了npm版本,对于这种情况我建议您在下一个版本更新或传递您的软件资源。
NodeJs version: 14.16.0 .节点版本:14.16.0 。 You can verify the version with this command if you had another NodeJs version installed
如果安装了另一个 NodeJs 版本,则可以使用此命令验证版本
node --version
Npm version: 6.4.11 You need verify if you had this version installed only you will able to validate this if you have NodeJs but if you didn't have node you can install the version I recommend you Npm 版本:6.4.11你需要验证你是否安装了这个版本只有当你有 NodeJs 时你才能验证这个但是如果你没有节点你可以安装我推荐你的版本
npm --version
After you set the NodeJs and npm versions you need to verify the following things设置 NodeJs 和 npm 版本后,您需要验证以下内容
Have visual studio 2015 or latest with the development for desktop component有 visual studio 2015 或最新的桌面组件开发
Have cmake program installed已安装 cmake 程序
Have git bash有 git bash
Have Java or the language you will to work有 Java 或您将使用的语言
Have the environment variables for the above programs I mentioned有我提到的上述程序的环境变量
Then you can try again to install open Cv然后你可以再次尝试安装open Cv
You need to reopen another or new terminal and then you will execute this command您需要重新打开另一个或新的终端,然后您将执行此命令
npm install --save openc4nodejs
And then然后
npm install -g openc4nodejs
After than or before don't forget to install appium I recommend you 1.19.1 version之后还是之前不要忘记安装appium 我推荐你1.19.1版本
You can verify if you have appium with opencv with open Cv doctor you can run appium-doctor
and check if the Open cv component are present.你可以验证你是否有带有 opencv 的 appium 和 open Cv doctor 你可以运行
appium-doctor
并检查 Open cv 组件是否存在。
For to install appium doctor you can run this command, npm install -g appium-doctor
要安装 appium doctor,您可以运行此命令,
npm install -g appium-doctor
I hope this answers will be helpful for you我希望这个答案对你有帮助
Autor: Eder Carbonero作 者:埃德卡博内罗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.