当前位置:   article > 正文

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

typeerror: web3 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大小写
  • 1
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/369197
推荐阅读
  

闽ICP备14008679号