小编har*_*roh的帖子

“id”参数必须是字符串类型。接收类型对象

当我创建第一个应用程序并运行时,我收到此错误。

类型错误 [ERR_INVALID_ARG_TYPE]:“id”参数必须是字符串类型。接收类型对象

const electron = require("electron");

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

let createWindow = () => {
  let window = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true,
    },
  });

  // load the index.html file
  window.loadFile("index.html");
  
  window.webContents.openDevTools();
};

app.whenReady().then(createWindow);

// Quit when all windows closed
app.on("window-all-closed", () => {
  if (process.platform !== "darwin") {
    app.quit();
  }
});

app.on("active", () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow();
  }
});
Run Code Online (Sandbox Code Playgroud)

这里出了什么问题?

node.js npm electron

9
推荐指数
1
解决办法
3万
查看次数

标签 统计

electron ×1

node.js ×1

npm ×1