TypeError: web3.eth.Contract is not a constructor错误解决

   

 

这是web3.js开发者在创建合约对象时很容易发生的错误,其实就是不同版本web3.js带来的API变化问题。

请检查你的web3.js版本:

  • 如果version<1.0.0,使用:
web3.eth.contract(studentFactoryArtifact,address);// 注意区分contract大小写
  • 1
  • 如果version>1.0.0,使用:
new web3.eth.Contract(studentFactoryArtifact,address); // 注意区分Contract大小写
posted @ 2018-10-01 08:35  web3网络科技  阅读(1378)  评论(0编辑  收藏  举报