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

ERROR TypeError: web3_1.default is not a constructor #22

Closed
agrofcsik opened this issue Dec 28, 2017 · 5 comments
Closed

ERROR TypeError: web3_1.default is not a constructor #22

agrofcsik opened this issue Dec 28, 2017 · 5 comments

Comments

@agrofcsik
Copy link

On:
this.web3 = new Web3(window.web3.currentProvider);
in web3.service.ts

I'm getting the following:
ERROR TypeError: web3_1.default is not a constructor

@agrofcsik
Copy link
Author

This seemed to solve my issue for now:
web3/web3.js#1155

@Ritin
Copy link

Ritin commented Jan 30, 2018

@agrofcsik the solution at https://github.com/ethereum/web3.js/issues/1155
did not work for me
import Web3 from 'web3';
gives the above mentioned (TypeError: web3_1.default is not a constructor)
import * as Web3 from 'web3';
webpack compile Fails

@agrofcsik
Copy link
Author

I ended up giving up and going with: angular4-truffle-starter-dapp which seems to work better.

@kmturley
Copy link

when changing from:
import Web3 from 'web3';

to:
import * as Web3 from 'web3';

I get a different error afterwards:

truffle_contract_1.default is not a function

Which seems to be fixed by changing the line:
import {default as contract} from 'truffle-contract';

to:
const contract = require('truffle-contract');

@sergeym610
Copy link

ERROR TypeError: web3_1.default is not a constructor
This problem was made me crazy a few days.
I used "npm install web3 --save" command and import Web3 from 'web3';
So, the error occurred!
In my experience, I removed "import Web3 from 'web3';" and added new lines like
"declare let Web3: any;
declare let web3;"

It works correctly for me.
I hope that this is correct resolve.
Thanks

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

No branches or pull requests

4 participants