my project dont work propably because it has a bcrypt function
ashgolan
HOBBYOP

6 months ago

Starting Container

Jun 16 22:54:55

npm warn config production Use --omit=dev instead.

Jun 16 22:54:55

Jun 16 22:54:55

> server@1.0.0 start

Jun 16 22:54:55

> node server.js

Jun 16 22:54:55

Jun 16 22:54:55

node:internal/modules/cjs/loader:1460

Jun 16 22:54:55

return process.dlopen(module, path.toNamespacedPath(filename));

Jun 16 22:54:55

^

Jun 16 22:54:55

Jun 16 22:54:55

Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header

Jun 16 22:54:55

at Module._extensions..node (node:internal/modules/cjs/loader:1460:18)

Jun 16 22:54:55

at Module.load (node:internal/modules/cjs/loader:1203:32)

Jun 16 22:54:55

at Module._load (node:internal/modules/cjs/loader:1019:12)

Jun 16 22:54:55

at Module.require (node:internal/modules/cjs/loader:1231:19)

Jun 16 22:54:55

at require (node:internal/modules/helpers:177:18)

Jun 16 22:54:55

at Object.<anonymous> (/app/node_modules/bcrypt/bcrypt.js:6:16)

Jun 16 22:54:55

at Module._compile (node:internal/modules/cjs/loader:1364:14)

Jun 16 22:54:55

at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)

Jun 16 22:54:55

at Module.load (node:internal/modules/cjs/loader:1203:32)

Jun 16 22:54:55

at Module._load (node:internal/modules/cjs/loader:1019:12) {

Jun 16 22:54:55

code: 'ERR_DLOPEN_FAILED'

Jun 16 22:54:55

}

Jun 16 22:54:55

Jun 16 22:54:55

Node.js v18.20.5

Jun 16 22:54:55

npm warn config production Use --omit=dev instead.

$10 Bounty

3 Replies

chandrika
EMPLOYEE

6 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open chandrika 6 months ago


czupryn013
HOBBY

6 months ago

Please provide more info. When is this error happening? Your build command? Possible package.json. Cause it looks like maybe it was build on another OS than the one on Railway or some kind of encoding thingy:
Error: /app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header - that's the main issue

You should build your app on Railway so there are no version/OS problems. Please give more info :)


joshjaminio
HOBBY

6 months ago

Hi,

This issue is usually caused by compiling the bcrypt binary on your local machine, which is a different environment than the one the Railway container runs in.

A good way to attempt fixing this issue would be to make sure your node_modules are added to your .gitignore file and that you are not uploading those to GitHub.

If the issue still persists after checking the above it might be a good idea to consider using bcryptjs instead.

If you could provide more context (such as your full build command, package.json file) I'd be able to look further for you.

I'd really appreciate if you could accept this answer if it solves your problem! Thanks


joshjaminio

Hi,This issue is usually caused by compiling the bcrypt binary on your local machine, which is a different environment than the one the Railway container runs in.A good way to attempt fixing this issue would be to make sure your node_modules are added to your .gitignore file and that you are not uploading those to GitHub.If the issue still persists after checking the above it might be a good idea to consider using bcryptjs instead.If you could provide more context (such as your full build command, package.json file) I'd be able to look further for you.I'd really appreciate if you could accept this answer if it solves your problem! Thanks

sim
FREE

6 months ago

These look correct - try it out? If you need debugging help, share you package.json


Loading...