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大小写
  • 如果version>1.0.0,使用:
new web3.eth.Contract(studentFactoryArtifact,address); // 注意区分Contract大小写
发布了39 篇原创文章 · 获赞 61 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/qq_33829547/article/details/81938727