Skip to content

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

Closed
gsans/riga-ng2-workshop
#2

Description

@SimonHawesome

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

Activity

  1. PatrickJS commented on Mar 1, 2016

    @PatrickJS
    Owner

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

  2. PatrickJS commented on Mar 1, 2016

    @PatrickJS
    Owner

    you might have to pull latest changes

  3. sumigoma commented on Mar 1, 2016

    @sumigoma

    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

  4. SimonHawesome commented on Mar 1, 2016

    @SimonHawesome
    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!

  5. sumigoma commented on Mar 2, 2016

    @sumigoma

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

  6. SimonHawesome commented on Mar 2, 2016

    @SimonHawesome
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions