i would want to make a node.js project with opencv but i failed to install opencv4node
. Can someone help me please .Here are the errors I encountered
i tried installing chocolatey, i saw it in someone’s answer ‘s post but it doesn’t work
npm install --save opencv4nodejs --build-from-source
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm error code 1
npm error path D:Local DiskstageL3backendnode_modulesopencv4nodejs
npm error command failed
npm error command C:Windowssystem32cmd.exe /d /s /c node ./install/install.js
npm error info install using lib dir: D:/Local Disk/stageL3/backend/node_modules/opencv-build/opencv/build/lib/Release
npm error D:Local DiskstageL3backendnode_modulesopencv4nodejsinstallinstall.js:37
npm error throw new Error('library dir does not exist: ' + libDir)
npm error ^
npm error
npm error Error: library dir does not exist: D:/Local Disk/stageL3/backend/node_modules/opencv-build/opencv/build/lib/Release
npm error at Object.<anonymous> (D:Local DiskstageL3backendnode_modulesopencv4nodejsinstallinstall.js:37:9)
npm error at Module._compile (node:internal/modules/cjs/loader:1469:14)
npm error at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
npm error at Module.load (node:internal/modules/cjs/loader:1288:32)
npm error at Module._load (node:internal/modules/cjs/loader:1104:12)
npm error at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
npm error at node:internal/main/run_main_module:28:49
npm error
npm error Node.js v20.17.0
2
Answers
Allow me to put the full error here as it couldn't fit in the comment section
It seems this error is caused by installing the package using "new" versions of node/npm. There are a lot of issues talking about this problem on the project’s Github repository, for example this one. Workarounds that might or might not lead to success include downgrading npm, installing a dependency of opencv4nodejs first, disabling automatic opencv.js building and installing node-gyp for building opencv.js automatically. You might want to search the Github issues for your error and read the discussions there for further information.
However, as the project’s README states, it is no longer maintained and you probably shouldn’t use it. Instead, it recommends using this fork, which provides rather detailed installation instructions.