类型错误 dialog.showmessageBoxSync 不是函数

type error dialog.showmessageBoxSync is not a function

我刚开始用electron,没用showmessageBoxSync:它returns错误:

type error dialog.showmessageBoxSync is not a function

showmessageBoxSync 不是 dialog 的成员,dialogrequire('electron'); 返回对象的 属性 吗?我错过了什么?对话框变量声明为:

const { app, BrowserWindow, dialog } = require('electron');

这是完整代码:

const { app, BrowserWindow, dialog } = require('electron');
const url = require('url');

function newApp() {
        
  dialog.showmessageBoxSync({
    message: 'hello world'
  });
  
  win = new BrowserWindow();
  win.loadURL(
    url.format({
      pathname: "index.html",
      slashes: true
    })
  );
  
  win.on('closed', () => {
      win = null;
  });
}

app.on("ready", newApp);

方法是dialog.showMessageBoxSync,大写M。