Opencv4nodejs: Can't install opencv4nodejs

Created on 20 Jun 2020  路  5Comments  路  Source: justadudewhohacks/opencv4nodejs

  1. I tried to install into RasberryPi.
  2. I installed CMake already
  3. I set

    • export OPENCV4NODEJS_DISABLE_AUTOBUILD=0

    • export OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION=4.1.0

  4. I tried to install opencv4nodejs via npm i opencv4nodejs
  5. I got the below error.

Error Message

$ npm i opencv4nodejs

> [email protected] install /home/pi/opencv-virtualuvc/node_modules/opencv4nodejs
> node ./install/install.js

info the following opencv4nodejs environment variables are set in the package.json: 
info autoBuildFlags: -DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_PC_FILE_NAME=opencv.pc 
info autoBuildOpencvVersion: 4.1.0 
info install OPENCV_LIB_DIR is not set, looking for default lib dir
info install using lib dir: /usr/local/lib
/home/pi/opencv-virtualuvc/node_modules/opencv4nodejs/install/install.js:45
  throw new Error('no OpenCV libraries found in lib dir: ' + libDir)
  ^

Error: no OpenCV libraries found in lib dir: /usr/local/lib
    at Object.<anonymous> (/home/pi/opencv-virtualuvc/node_modules/opencv4nodejs/install/install.js:45:9)
    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)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node ./install/install.js`
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-06-19T22_35_51_386Z-debug.log

Auto Build - Full Error Log

I'd like Auto Build. But I don't know where Auto Build Error Log is.

OpenCV version (example 3.4.1): ?.?.?

With OpenCV-contrib? (extra modules): ?

OS: Raspbian GNU/Linux 10 (buster)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Most helpful comment

throw new Error('no OpenCV libraries found in lib dir: ' + libDir) indicate that it is looking for the libDir-folder which should be set when _not_ using autobuild.

Does the error persist if you unset OPENCV4NODEJS_DISABLE_AUTOBUILD? I experienced that the mere presence of the env variable was interpreted as "truthy" no matter the value.

Edit: Which I have opened a PR to solve - https://github.com/justadudewhohacks/npm-opencv-build/pull/42

All 5 comments

I am also getting this same error whenever trying to npm install.

throw new Error('no OpenCV libraries found in lib dir: ' + libDir) indicate that it is looking for the libDir-folder which should be set when _not_ using autobuild.

Does the error persist if you unset OPENCV4NODEJS_DISABLE_AUTOBUILD? I experienced that the mere presence of the env variable was interpreted as "truthy" no matter the value.

Edit: Which I have opened a PR to solve - https://github.com/justadudewhohacks/npm-opencv-build/pull/42

unset OPENCV4NODEJS_DISABLE_AUTOBUILD

This seemed to resolve this particular issue for me. Thank you :+1:

As someone mentioned in one of the previous issues, manually building it worked for me.

First, go to the corresponding directory.

cd node_modules/opencv4nodejs/build

Then build manually.

make

Finally, add this to your package.json file, inside your "scripts"

"postinstall": "cd node_modules/opencv4nodejs/build; make"

I believe the problem is caused by a faulty autobuild.

I got solution.

Don't try to run npm from any of C:/Windows/... folder inside Windows

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlbernard2 picture karlbernard2  路  4Comments

OluAgunloye picture OluAgunloye  路  3Comments

bgsuello picture bgsuello  路  6Comments

YaronHershkovitz picture YaronHershkovitz  路  6Comments

ShadabFaiz picture ShadabFaiz  路  7Comments