[英]web3 (then property) in ethereum node
请您帮忙:当我在Node.js控制台中运行以下命令时,出现以下错误:(我正在使用web3 0.20.0)在Windows 10上
web3.eth.getAccounts()。then(e => console.log(e));
错误如下:
TypeError: Cannot read property 'then' of undefined
> TypeError: callback is not a function
at c:\Users\Salam Khanji\Ether\node_modules\web3\lib\web3\property.js:119:13
at c:\Users\Salam Khanji\Ether\node_modules\web3\lib\web3\requestmanager.js:89:9
at XMLHttpRequest.request.onreadystatechange (c:\Users\Salam Khanji\Ether\node_modules\web3\lib\web3\httpprovider.js:119:7)
at XMLHttpRequestEventTarget.dispatchEvent (c:\Users\Salam Khanji\Ether\node_modules\web3\node_modules\xhr2\lib\xhr2.js:64:18)
at XMLHttpRequest._setReadyState (c:\Users\Salam Khanji\Ether\node_modules\web3\node_modules\xhr2\lib\xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (c:\Users\Salam Khanji\Ether\node_modules\web3\node_modules\xhr2\lib\xhr2.js:509:12)
>
我猜他们可能是以下问题之一
geth --rpc --rpccorsdomain“ *” –rpcapi eth,net,web3,personal,miner,txpool,debug --datadir〜/ Desktop / local-network /
var accounts = web3.eth.accounts;//Will return all the accounts.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.