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 · 2 comments
Closed

Cannot bundle bcrypt #874

carlgieringer opened this issue May 5, 2021 · 2 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

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