[英]How to solve [web3.eth.Contract is not a constructor]
I`m geting this error. 我收到此错误。
truffle(development)> const mycontract = new web3.eth.Contract(abi, contractAddress)
Thrown:
TypeError: web3.eth.Contract is not a constructor
This happens when I set mycontract
on console. 当我在控制台上设置
mycontract
,会发生这种情况。 Web3 version is `1.0.0 Web3版本为1.0.0
Could you give me any advise, please? 请给我任何建议吗?
Assuming you are on Truffle 5 and you already run truffle deploy
command, you can simply run the following in your truffle console
terminal: 假设您使用的是Truffle 5,并且已经运行了
truffle deploy
命令,则可以在truffle console
终端中简单地运行以下命令:
const mycontract = await YourContract.deployed()
// or
const mycontract = await YourContract.at("0x_your_contract_address")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.