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

"Error: Entropy source not available." running webpack build #8

Closed
pinheadmz opened this issue Dec 6, 2018 · 1 comment
Closed

Comments

@pinheadmz
Copy link
Member

I want to make a bundled js application that can generate secure random.randomBytes(32) WITHOUT requiring the user to compile the cpp bindings, etc. I am hoping this application will work similar to the browser mode of bcoin, which compiles and runs fine without this error! (last time I checked... 😬)

package.json

...
  "scripts": {
    "build": "webpack --mode production"
  }
...
  "dependencies": {
    "bcrypto": "^3.0.1",
...

webpack.config.js

const path = require('path');

module.exports = {
  target: 'node',
  node: {
    __dirname: false,
    __filename: false,
  },
  resolve: {
    modules: ['node_modules'],
    extensions: ['-compat.js', '-browser.js', '.js', '.json']
  },
  entry: './index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  }
};

Attempt build: npm run webpack
Attempt run: node dist/bundle.js

Error: Entropy source not available.

I've tried to include NODE_BACKEND=js before the webpack command, which seems to have no effect.

I otherwise am confident the js backends are bundling, because when I exclude the resolve statement I get the error:

TypeError: Cannot read property 'randomFill' of undefined
@chjj
Copy link
Member

chjj commented Jun 12, 2019

I'm probably the wrong person to ask since I've never been able to properly compile node modules with webpack (or anything else). bpkg will work better for this.

@chjj chjj closed this as completed Jun 12, 2019
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