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

Cannot bundle bcrypt #874

Closed
carlgieringer opened this issue May 5, 2021 · 3 comments
Closed

Cannot bundle bcrypt #874

carlgieringer opened this issue May 5, 2021 · 3 comments

Comments

@carlgieringer
Copy link

carlgieringer commented May 5, 2021

Hi,

I'm trying to bundle a node application that includes bcrypt. I am having a problem bundling bcrypt. I am using esbuild because it's quick and easy, but I think that the issue exists with any bundling solution (webpack, etc.)

I have a repro repo: https://github.com/carlgieringer/bcrypt-bundle-issue

My environment:
node v14.16.0
macOS 10.15.7

The README in the repo explains the repro steps, but basically if you build and then try and run the bundled app, it fails on bcrypt.js:5 where it passes in a path to package.json. For one, this would fail if I was trying to run the app in a directory lacking a package.json. But what happens in that repo is that node-pre-gyp complains that the package.json (the one for my example repo) is missing required fields:

package.json must declare these properties:
binary

Thanks!

@carlgieringer
Copy link
Author

I think I can replace bcrypt wiith bcryptjs to solve this.

@recrsn
Copy link
Collaborator

recrsn commented May 6, 2021

Native nodejs modules cannot be bundled. We won't be able to fix this issue ever

@Bessonov
Copy link

Bessonov commented Dec 2, 2024

Native nodejs modules cannot be bundled. We won't be able to fix this issue ever

Of course, they can be bundled, and there are already many heavyweight modules with native parts, like sharp. Sharp even works on AWS Lambda.

In fact, I got bcrypt working with a workaround: mapbox/node-pre-gyp#308 (comment).

Therefore, I propose to reopen the issue.

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

3 participants