Can't install OpenCV NPM wrapper

  • Hi,

    I just get working my Shinobi installation, I am moving from Zoneminder wich have been serving me well for years, but now i discover Shinobi an it is really nice option to switch.

    I did my install on Ubuntu Server 16.04, I Followed the instrucctions for installing Shinobi, CUDA and Motion without any problems, after i tryed to get OpenCV running, I had no problem compiling OpenCV but for some reason i cant install the opencv npm wrapper.

    I have been trying for a while now and i run out of ideas... any help is very welcocme!

    The error looks like: fallo en las instrucciones para el objetivo 'Release/'
    make: *** [Release/] Error 1
    make: se sale del directorio '/usr/src/Shinobi/node_modules/opencv/build'
    gyp ERR! build error
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:258:23)
    gyp ERR! stack     at emitTwo (events.js:126:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    gyp ERR! System Linux 4.4.0-116-generic
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64/opencv.node" "--module_name=opencv" "--module_path=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64"
    gyp ERR! cwd /usr/src/Shinobi/node_modules/opencv
    gyp ERR! node -v v8.11.1
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok
    node-pre-gyp ERR! build error
    node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64/opencv.node --module_name=opencv --module_path=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/src/Shinobi/node_modules/opencv/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
    node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    node-pre-gyp ERR! System Linux 4.4.0-116-generic
    node-pre-gyp ERR! command "/usr/bin/node" "/usr/src/Shinobi/node_modules/opencv/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /usr/src/Shinobi/node_modules/opencv
    node-pre-gyp ERR! node -v v8.11.1
    node-pre-gyp ERR! node-pre-gyp -v v0.6.39
    node-pre-gyp ERR! not ok
    Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64/opencv.node --module_name=opencv --module_path=/usr/src/Shinobi/node_modules/opencv/build/opencv/v6.0.0/Release/node-v57-linux-x64' (1)
    npm WARN [email protected] had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.
    npm WARN [email protected] license should be a valid SPDX license expression
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


  • After a lot of try and error I have been able to install opencv, i'm not able to reproduce all the steps because i get it working after hours of kind of erratic work xDD but for sure i installed node-gyp and noede-pre-gyp globally and after install this opencv package npm install peterbraden/node-opencv and after installed npm install opencv (not even sure if they are the same package)

    The point is now shinobi plugin (shinobi-opencv) start fine:

    0|camera   | 2018-04-10T21:32:02+02:00 pluginInitiatorSuccess { f: 'init',
    0|camera   |   plug: 'OpenCV',  pluginKey: 'pluginkey' }
    0|camera   | 2018-04-10T21:32:02+02:00 Connected to plugin : Detector - OpenCV -                       undefined

    but when i try to detect something y get this errors with pm2 logs

    2|shinobi- | OpenCV Error: Unspecified error (The node is neither a map nor an e                         mpty collection) in cvGetFileNodeByName, file /root/opencv/modules/core/src/pers                         istence.cpp, line 891
    2|shinobi- | terminate called after throwing an instance of 'cv::Exception'
    2|shinobi- |   what():  /root/opencv/modules/core/src/persistence.cpp:891: error                         : (-2) The node is neither a map nor an empty collection in function cvGetFileNo                         deByName

    I tryed my OpenCV instalation and it was able to detect faces using Haars cascades with an stand alone python script.

    This is the point i am now and i'm running out of ideas... @moeiscool any clue what could be happening?



Looks like your connection to Shinobi Forum was lost, please wait while we try to reconnect.