【发布时间】:2020-04-29 19:38:06
【问题描述】:
我是 Electron js 的初学者。当我创建我的第一个应用程序并运行时,我收到了这个错误。
TypeError [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();
}
});
这里出了什么问题?
【问题讨论】: