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

TypeError: KeyEncoder is not a constructor #16

Open
xird opened this issue Mar 3, 2020 · 1 comment · May be fixed by #17
Open

TypeError: KeyEncoder is not a constructor #16

xird opened this issue Mar 3, 2020 · 1 comment · May be fixed by #17

Comments

@xird
Copy link

xird commented Mar 3, 2020

I'm trying to use the library, but can't even get started due to an error: "TypeError: KeyEncoder is not a constructor"

To reproduce:

  • In a new directory, npm init
  • npm i key-encoder
  • In index.js, add just the two lines from the README:
var KeyEncoder = require('key-encoder'),
    keyEncoder = new KeyEncoder('secp256k1')
  • run "node index.js"

Result:

    keyEncoder = new KeyEncoder('secp256k1')
                 ^

TypeError: KeyEncoder is not a constructor

Expected result: No output.

@friedger
Copy link

friedger commented Mar 3, 2020

You should add .default with the required call, like this:

var KeyEncoder = require('key-encoder').default

@friedger friedger linked a pull request Mar 3, 2020 that will close this issue
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.

2 participants