【发布时间】:2019-06-23 09:38:49
【问题描述】:
[Geth 客户端命令]
geth --rinkeby --rpc --rpcaddr "0.0.0.0" --rpcvhosts=* --rpcport "8545" --rpcapi "eth,net,web3,personal,admin" --syncmode "light" --cache "64"
[node.js Web3 代码]
var Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.personal.newAccount("test").then(console.log)
这是我在下面看到的错误消息
> TypeError:最新的参数应该是一个函数,否则它 不能作为回调 在 NewAccountMethod.set (C:\Users\june\Documents\WebProject\webWalletTest\node_modules\web3-core-method\dist\web3-core-method.cjs.js:411:17) 在 Proxy.anonymousFunction (C:\Users\june\Documents\WebProject\webWalletTest\node_modules\web3-core-method\dist\web3-core-method.cjs.js:224:28)
我想查看一个函数“web3.eth.personal.newAccount”。但我找不到函数。
即使我尝试使用双标签(自动完成)找出答案,但它并不存在。
它消失了吗?
【问题讨论】:
-
你确定这是错误信息吗?至少,它似乎少了一个字。请复制/粘贴实际的错误消息。
-
我修改了错误信息的部分。
-
你确定实际的错误信息不是“最新的参数应该是一个函数,否则不能用作回调”?
-
这是我收到的实际错误消息。很奇怪吗?
-
是的,因为至少该代码的当前版本具有我描述的错误消息。也许你有一个有错字的旧版本?你用的是什么版本的 web3.js?
标签: node.js blockchain ethereum web3 geth