-
Notifications
You must be signed in to change notification settings - Fork 41
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
[Electron] TypeError: Cannot read property 'randomBytes' of undefined #27
Comments
Possible duplicate issue: #15 Looks like the recommendation for now is to fall back to the JavaScript methods. |
The environment variable is |
Thanks for the reply. I tried playing around with
In other words, it throws the exception here: but does not enter the catch block here: |
This stack trace is confusing. Why does electron succeed at dynamically loading the binding? The
@supaiku0, what about We only fall back to the JS random backend in the browser (which uses I'm still fuzzy on what electron does/doesn't support and there doesn't seem to be a simple writeup anywhere. Personally I prefer not to touch electron, so I'm basically shooting in the dark here. |
Also, is there an easy way to detect electron? Do they expose a property on the |
It looks like |
@chjj @tynes This is a bit embarassing, but it's not actually Electron at fault here. I was only able to reproduce the error when running unit tests via Sorry, for the confusion! |
We run into the following issue when using
bcrypto 4.1.0
inside Electron:From what I can tell loading the native module succeeds:
https://github.com/bcoin-org/bcrypto/blob/master/lib/random.js#L10
but calling
randomBytes
fails becausecrypto
is missing. Manually forcing to./node/random
resolves it (can we get an environment variable for it? 😛 ).I also tried a
npm rebuild
without success.Many thanks in advance.
The text was updated successfully, but these errors were encountered: