Node.js I get TypeError:无法读取属性';发送';mocha测试I和x27的空值;我写的是坚实的

Node.js I get TypeError:无法读取属性';发送';mocha测试I和x27的空值;我写的是坚实的,node.js,mocha.js,ethereum,solidity,Node.js,Mocha.js,Ethereum,Solidity,我正在为智能合约编写测试,但遇到了一个错误 这是密码 beforeEach ( async () => { // Get a list of all accounts accounts = await web3.eth.getAccounts(); // use one of those accounts to deploy the contract inbox = await new web3.eth.Contract(JSON.parse(inter

我正在为智能合约编写测试,但遇到了一个错误

这是密码

 beforeEach ( async () => {
    // Get a list of all accounts
    accounts = await web3.eth.getAccounts();

    // use one of those accounts to deploy the contract
    inbox = await new web3.eth.Contract(JSON.parse(interface))
        .deploy({ data: bytecode, arguments: ['Hello'] })
        .send({from: accounts[0], gas: '1000000'});    
 });

 describe("Inbox", () => {
    it('deploys a contract',() => {
        console.log(inbox);
    })
 })

错误呢

  Inbox
    1) "before each" hook for "deploys a contract"

  1) "before each" hook for "deploys a contract":
     TypeError: Cannot read property 'send' of null
      at Context.beforeEach (test/Inbox.test.js:63:9)
      at process._tickCallback (internal/process/next_tick.js:68:7)

我做错了什么?

问题是我将合同的初始构造函数设置为private;这意味着它没有初始化,所以我没有部署字节码,因此为空