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

Crypto.randomBytes is not a function–an uncaught TypeError #365

Closed
SimonHawesome opened this issue Feb 29, 2016 · 6 comments · Fixed by gsans/riga-ng2-workshop#2
Closed

Comments

@SimonHawesome
Copy link

Hi 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

@PatrickJS
Copy link
Owner

can you update es7-reflect-metadata 1.6.0 and typescript to 1.8.2

@PatrickJS
Copy link
Owner

you might have to pull latest changes

@sumigoma
Copy link

sumigoma commented Mar 1, 2016

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

@SimonHawesome
Copy link
Author

Updating es7-reflect-metadata to 1.6.0 and
typescript to 1.8.2 and
pulling the latest pollyfills.ts seemed to have fixed the issue!

Thanks for your help and quick reply!

@sumigoma
Copy link

sumigoma commented Mar 2, 2016

Can confirm, latest polyfills and webpack config fixes the issue. Please close.

@SimonHawesome
Copy link
Author

Hooray!

On Tuesday, March 1, 2016, Yuki K notifications@github.com wrote:

Can confirm, latest polyfills and webpack config fixes the issue. Please
close.


Reply to this email directly or view it on GitHub
#365 (comment)
.

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

Successfully merging a pull request may close this issue.

3 participants