簡體   English   中英

web3 getAccounts 沒有得到解決

[英]web3 getAccounts doesn't get resolved

web3.eth.getAccounts() 對我不起作用。 下面的代碼顯示了執行時的“錯誤”(被拒絕)。 我正在使用 web3 1.0.0 beta-46。 我正在從 Stephen Grider 的教程視頻中學習,他使用了 beta-26,是版本相關的問題還是我做錯了什么?

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());

web3.eth.getAccounts()
    .then(fetchedAccounts => {
      console.log(fetchedAccounts);
    },() => {
      console.log("error");
    });

自己還沒有嘗試過,但這似乎是最新版本的web3的錯誤。 嘗試使用 1.0.0 beta-37 ?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM