19

I am getting this error when running an example from OpenCV Node

  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /home/sunny/face/build/opencv/v5.0.0/Release/node-v46-linux-x64/opencv.node: undefined symbol: _ZNK2cv9Algorithm5writeERNS_11FileStorageE
    at Error (native)
    at Object.Module._extensions..node (module.js:460:18)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object. (/home/sunny/face/lib/bindings.js:4:15)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
mscdex
  • 104,356
  • 15
  • 192
  • 153
Saurav kumar
  • 407
  • 2
  • 5
  • 11

7 Answers7

31

Try refreshing your installed modules by

$ rm -rf node_modules/
$ npm update

I got errors relating to process.dlopen when using Gulp and node-sass. Clearing the installed modules fixed the issue for me.

EDIT: Not certain how OpenCV works (or what it actually is), but I presume it handles NodeJS modules similarly to regular NodeJS applications, where you can refresh the module collection.

ojrask
  • 2,799
  • 1
  • 23
  • 23
13

Use this command, it works fine:

npm rebuild bcrypt --build-from-source
Pingolin
  • 3,161
  • 6
  • 25
  • 40
Amol Barshile
  • 196
  • 1
  • 4
3

I had the same issue and it turns out docker is running linux and bcrypt was made on macOS and there is some sort of compatibility issue if you don't run npm install within docker.

For me adding a .dockerignore file and adding in the node_module folders for the project then running RUN npm install in the Dockerfile resolved it.

jawn
  • 851
  • 7
  • 10
2

You should check your OpenCV installation, it's probably either missing/can't be found or its not a version supported by the OpenCV node binding. Assuming you're using the opencv module on npm, its readme says that OpenCV versions from v2.3.1 until v3.0.0 are (fully) supported.

mscdex
  • 104,356
  • 15
  • 192
  • 153
2

My case, I have the node_modules on my .dockerignore

node_modules
upload
export
converage
.git
.tmp
.vscode
.github
.env

But I still have to make docker-compose be able to ignore the node_modules folder.

services:
  api:
    build: .
    command: npm run dev
    volumes:
      - '.:/usr/src/app'
      - /usr/src/app/node_modules/
    ports:
      - "3000:3000"
    

docker-compose will skip copy node_modules which is built for MacOS into Linux container.

Add a volume to Docker, but exclude a sub-folder

vanduc1102
  • 5,769
  • 1
  • 46
  • 43
0

I ran these commands but to no success

$ rm -rf node_modules/
$ npm update

The only thing that helped me was

yarn add node-sass

Finally my node modules were installed successfully.

Black Mamba
  • 13,632
  • 6
  • 82
  • 105
0

Use this command, it works fine:

rm -r node_modules

And after that use install command again:

npm i --save