Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with official docker image #176

Open
rstoye opened this issue Jan 16, 2025 · 1 comment
Open

Issues with official docker image #176

rstoye opened this issue Jan 16, 2025 · 1 comment

Comments

@rstoye
Copy link

rstoye commented Jan 16, 2025

Hey there,

I'm trying to get a nestjs service of mine production ready and I'm struggling with the deployment process when using docker. Even with the official docker image I can't get the application to run.

I have provided an example project that anyone can clone and try for themself https://github.com/rstoye/opencv-troubleshoot-2. Just follow the readme of that repo to recreate the error.

The issue is that after installing the npm packages, linking the globally installed @u4/opencv4nodejs module and building the project, I get the following error upon running the build:

Error: Cannot find module '/usr/local/lib/node_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs'
Require stack:
- /usr/local/lib/node_modules/@u4/opencv4nodejs/lib/cvloader.js
- /usr/local/lib/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js
- /usr/src/app/app.service.js
- /usr/src/app/app.controller.js
- /usr/src/app/app.module.js
- /usr/src/app/main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at getOpenCV (/usr/local/lib/node_modules/@u4/opencv4nodejs/lib/cvloader.js:55:23)
    at loadOpenCV (/usr/local/lib/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js:9:43)
    at Object.<anonymous> (/usr/local/lib/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js:24:12)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/@u4/opencv4nodejs/lib/cvloader.js',
    '/usr/local/lib/node_modules/@u4/opencv4nodejs/lib/opencv4nodejs.js',
    '/usr/src/app/app.service.js',
    '/usr/src/app/app.controller.js',
    '/usr/src/app/app.module.js',
    '/usr/src/app/main.js'
  ]
}

The error makes sense in that there certainly is no build folder under /usr/local/lib/node_modules/@u4/opencv4nodejs/. Why the path for the module wants to access a build/Release directory is beyond me. All I do in my source code is importing like so import * as openCv from '@u4/opencv4nodejs';

Any help on this matter would be greatly appreciated.

@sanjana1999
Copy link

Facing the same issue. Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants