I have installed "@ethereumjs/common": "^2.0.0",

And and then using it -

import Common from '@ethereumjs/common';
const c = new Common({ chain: 'ropsten' })

And getting error Uncaught TypeError: Common is not a constructor.

What I am doing wrong?

  • Try import { Common } from '@ethereumjs/common';. Dec 2 '20 at 10:38
  • And also import * as Common from '@ethereumjs/common';. Dec 2 '20 at 10:38
  • Tried both, but still the same. Dec 2 '20 at 10:42
  • Their GitHub Project suggests that you should import ethereumjs-common. Dec 2 '20 at 10:46
  • At the top of that page if you have noticed, they announced repository moved and clicking that forwards you to new modular transaction. And I am using that one. Dec 2 '20 at 10:48

Seems like its a bug. I tried to raise the issue to the maintainer repo. You can follow rest of the discussion here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.