justadudewhohacks / opencv4nodejs

Nodejs bindings to OpenCV 3 and OpenCV 4
MIT License
4.97k stars 827 forks source link

[facemark.js ]FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. #838

Closed cherishman2005 closed 2 years ago

cherishman2005 commented 2 years ago

Error Message

# node facemark.js 
loading data from : /home/nodejs/face_detection/data/face/lbfmodel.yaml
[ INFO:0] Initialize OpenCL runtime...
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: 0x8f94d0 node::Abort() [node]
 2: 0x8f951c  [node]
 3: 0xafc06a v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0x7f7b191f1257 FacemarkBindings::GetFacesWorker::getReturnValue() [/home/nodejs/face_detection/node_modules/opencv4nodejs/build/Release/opencv4nodejs.node]
 5: 0x7f7b190ccd2a FF::SyncBinding::SyncBinding(std::shared_ptr<FF::IWorker>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Nan::FunctionCallbackInfo<v8::Value> const&) [/home/nodejs/face_detection/node_modules/opencv4nodejs/build/Release/opencv4nodejs.node]
 6: 0x7f7b191eebc6 Facemark::GetFaces(Nan::FunctionCallbackInfo<v8::Value> const&) [/home/nodejs/face_detection/node_modules/opencv4nodejs/build/Release/opencv4nodejs.node]
 7: 0x7f7b19079d07  [/home/nodejs/face_detection/node_modules/opencv4nodejs/build/Release/opencv4nodejs.node]
 8: 0xb89524  [node]
 9: 0xb8a0a6 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
10: 0x1314db3dbe1d 
Aborted

Auto Build - Full Error Log

Manual Build - Environment Information

OpenCV version (example/facemark.js ): "opencv4nodejs": "^4.7.2"

With OpenCV-contrib? (extra modules): yes/no?

OS: Ubuntu16.04

cherishman2005 commented 2 years ago

Error Message

"opencv4nodejs": "^5.6.0"

/home/nodejs/face_detection/facemark.js:6
if (!cv.xmodules.face) {
                 ^

TypeError: Cannot read property 'face' of undefined
    at Object.<anonymous> (/home/nodejs/face_detection/facemark.js:6:18)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
UrielCh commented 2 years ago

Hi,

I have this problem too, It's strange, I did not find any reference to xmodules, it the code, the module flag are indeed defined in modules (without the x)

I had to add this code to make it works

cherishman2005 commented 2 years ago

I resolve it:

https://github.com/cherishman2005/rtc/discussions/44