opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

Error when using Node 19

Open ThornWalli opened this issue 1 year ago • 6 comments

Hello,

I'm using a MacBook Pro M2 Max, but I suspect my problem is more with Node.

  1. got it running problem free with Node 16.20.0.
"opencv4nodejs": {
    "autoBuildOpencvVersion": "4.8.0"
  }
build-opencv configure
build-opencv build
  1. my second attempt was then with Node 19.9.0,

Same configuration as point 1., the command build-opencv configure is executed successfully.

But with the command build-opencv build I get 3 errors while compiling...

ERR! install node-gyp failed and return Error Command failed: node-gyp build --jobs max --release 
ERR! install gyp info it worked if it ends with ok
ERR! install gyp info using [email protected]
ERR! install gyp info using [email protected] | darwin | arm64
ERR! install gyp info spawn make
ERR! install gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 12 ]
ERR! install In file included from ../cc/opencv4nodejs.cc:1:
ERR! install In file included from /xxx/Library/Caches/node-gyp/19.9.0/include/node/node.h:73:
…
ERR! install         __get_elem()->~_Tp();
ERR! install                        ^
ERR! install 23 warnings and 4 errors generated.
ERR! install make: *** [Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o] Error 1
ERR! install gyp ERR! build error 
ERR! install gyp ERR! stack Error: `make` failed with exit code: 2
ERR! install gyp ERR! stack     at ChildProcess.onExit (/xxx/Desktop/opencv/node_modules/node-gyp/lib/build.js:203:23)
ERR! install gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
ERR! install gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
ERR! install gyp ERR! System Darwin 22.6.0
ERR! install gyp ERR! command "/xxx/.nvm/versions/node/v19.9.0/bin/node" "/xxx/Desktop/opencv/node_modules/.bin/node-gyp" "build" "--jobs" "max" "--release"
ERR! install gyp ERR! cwd /xxx/Desktop/opencv/node_modules/@u4/opencv4nodejs
ERR! install gyp ERR! node -v v19.9.0
ERR! install gyp ERR! node-gyp -v v9.4.0
ERR! install gyp ERR! not ok 
ERR! install  return code: 1
  1. When I try the Node 16 build in Node 19, I get this message:
node:internal/modules/cjs/loader:1361
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Module did not self-register: 'xxx/Desktop/opencv/node_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs.node'.
    at Module._extensions..node (node:internal/modules/cjs/loader:1361:18)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at getOpenCV (xxx/Desktop/opencv/node_modules/@u4/opencv4nodejs/lib/cvloader.js:54:23)
    at loadOpenCV (xxx/Desktop/opencv/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js:6:48)
    at Object.<anonymous> (xxx/Desktop/opencv/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js:21:12)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10) {
  code: 'ERR_DLOPEN_FAILED'
}

ThornWalli avatar Sep 19 '23 14:09 ThornWalli

Same, works on 18 though

Djelnar avatar Oct 18 '23 22:10 Djelnar

please only use stable nodeJS version (14, 16, 18, 20) not 17, 19, 21 ...

UrielCh avatar Oct 21 '23 08:10 UrielCh

test with nodeJS 20 in progress, it's look's to works fine.

UrielCh avatar Oct 24 '23 14:10 UrielCh

@UrielCh I tested again with Node 20.10.0.

Unfortunately I get errors with the build.

log.txt

But with version 18.16.0 it worked :)

ThornWalli avatar Nov 29 '23 16:11 ThornWalli

Sorry, I 'm still in a complicated situation, jobless and homeless, I cannot help right now 😞

UrielCh avatar Nov 29 '23 18:11 UrielCh

@UrielCh if you were able to install this with NodeJS20 please tell me what am I doing wrong: https://github.com/UrielCh/opencv4nodejs/issues/121

sollosollo4 avatar Jan 09 '24 23:01 sollosollo4