-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
Getting MODULE_NOT_FOUND error while running Nodejs application with sqlite3 in the docker container #1677
Comments
problem is you building on alpine, this makes node-pre-gyp to download prebuild binary for sqlite for that platform, and then you running acutal code on debian-based distro. these two distros have different libc runtime - musl vs glibc. |
try adding following instructions in your builder layer, after
this will force node-pre-gyp to download additional binary to be used in node:16-slim. this helped me to solve similar issue today. |
I have a similar issue where I use
I don't have a multi-stage build like polyglot-me so the build and runtime environment are the same. This architecture is claimed as supported tho: https://github.com/TryGhost/node-sqlite3#prebuilt-binaries. |
I looked at https://github.com/TryGhost/node-sqlite3/blob/master/.github/workflows/ci.yml and saw the build version matrix is a bit outdated (no node 19, 20, for docker/musl targeting node 16 and alpine3.15). So I tried with
Note: it works with |
@fedulovivan please I want to learn about this node-gyp or platform-dependent building thing. How can you help me? Any resources, where can I read it up? Can I pay you for consultation? I really want and need to fill this my Node JS knowedge gap. Thank you |
Issue Summary
Hi Everyone,
I'm not able to run my Nodejs v16 application in the docker container. Ending up with MODULE_NOT_FOUND error. Can someone help me what can be the issue and the solution? I'm using the latest sqlite3 version in my package.json
Here is my docker file
Image is built successfully but when I run the container I'm seeing this issue. Any help would be much appreciated.
Thanks
Relevant logs or output
Error: Cannot find module '/usr/src/app/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node'
Require stack:
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/usr/src/app/node_modules/sqlite3/lib/sqlite3-binding.js:4:17)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/src/app/node_modules/sqlite3/lib/sqlite3-binding.js',
'/usr/src/app/node_modules/sqlite3/lib/sqlite3.js',
'/usr/src/app/build/entity/data-service/sqlite.helper.js',
'/usr/src/app/build/entity/data-service/dataservice.controller.js',
'/usr/src/app/build/route.js',
'/usr/src/app/build/index.js'
Version
5.1.4
Node.js Version
16
How did you install the library?
docker alpine
The text was updated successfully, but these errors were encountered: