[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核心-method.cjs.js:411:17)在Proxy.anonymousFunction(C:\Users\june\Documents\WebProject\webWalletTest\node_modules\web3核心方法\dist\web3核心方法.cjs.js:224:28)
我想看一个函数"web3.eth.personal.newAccount"。但我找不到该函数。
甚至我也试着用双标签(自动完成)来找到它,但它并不存在。
它不见了吗?
我直接使用了web3.personal
,并且能够再次访问其中的方法。
这很奇怪,因为在控制台中,web3.eth.personal
仍然有效,但在浏览器的脚本中却无效。