Crypto.randomBytes is not a function–an uncaught TypeError
See original GitHub issueHi there,
The error I am receiving: Crypto.randomBytes is not a function seems to derive from the ./~/es7-reflect-metadata/src/helper/gen-randombytes.ts file
gen-randonbytes.ts file includes:
import * as crypto from "crypto";
import {BufferLike} from "./interfaces";
export function genRandomBytes(size: number): BufferLike {
return crypto.randomBytes(size); //Here is where the error occurs
}
I am running: es7-reflect-metadata: ^1.5.5, typescript: 1.7.5, angular2: 2.0.0-beta.7, npm: 3.8.0, node: 5.6.0
Thanks in advance for your help!
Simon
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Node.js crypto.randomBytes() is not a function
I ran into this same error in the command line: Uncaught TypeError: crypto.randomBytes is not a function. This did NOT work for me:...
Read more >TypeError: crypto.randomBytes is not a function #150
When activating an experiment as follows: optimizelyClient.activate('experiment', 'user123') returns null and the logger shows this error ...
Read more >Node.js crypto.randomBytes() Method
The crypto.randomBytes() method is used to generate a cryptographically well-built artificial random data and the number of bytes to be ...
Read more >TypeError: crypto.randomBytes is not a function
Crypto object is being set as an empty object and that is the reason why randomBytes is not a function. But why? crypto...
Read more >TypeError: crypto.randomBytes is not a function-node.js
This is my code where I am using rest password import crypto from 'crypto-js'; import { nanoid } from "nanoid"; userSchema.methods.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Seeing the same error with latest changes, is es7-reflect-metadata missing a dependency on crypto (^0.0.3)?
https://github.com/gdi2290/es7-reflect-metadata/blob/master/package.json
Hooray!
On Tuesday, March 1, 2016, Yuki K notifications@github.com wrote: