web3 getAccounts无法解析

aks*_*rma 2 ethereum solidity web3js web3-donotuse

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");
    });
Run Code Online (Sandbox Code Playgroud)

gom*_*mes 5

没有尝试过,但这似乎是最新版本的版本web3.试试1.0.0 beta-37?