peterbraden/node-opencv

[BUG] On RaspPi 3, nodejs, simply require opencv crash

pedefe opened this issue · 1 comments

Hello,

on RapsPi 3 I follow the following steps:
¤ apt-get install libopencv-dev
In my nodejs project (already moving a standalone robot with servos, etc...),
¤ npm install opencv
Then I just require "opencv" in my test_opencv.js file :
¤ var cv = require("opencv");
Then I execute:
¤ node test_opencv.js
Then :
root@raspberrypiNEXO-01:~/nodejs/AutoMove# node test_opencv.js
internal/modules/cjs/loader.js:807
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: libopencv_videostab.so.3.4: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/root/nodejs/AutoMove/node_modules/opencv/lib/bindings.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)

Best regards.

Found a solution...
¤ find where is opencv libraries listed in debug-log:
... find / -name "libopencv_core.so.3.4*"
... /root/nodejs/AutoMove/node_modules/opencv-build/opencv/build/lib/libopencv_core.so.3.4

¤ In /etc/ld.so.conf.d folder, create text file "opencv.conf"
... write found-path in it, i.e. "/root/nodejs/AutoMove/node_modules/opencv-build/opencv/build/lib"

¤ Execute : ldconfig -v | grep opencv
> verify that "opencv" items are listed.

¤ Then nodejs program runs without error.