Javascript 未捕获(承诺中)类型错误:无法读取属性';buildFromTemplate';HtmlButtoneElement.getVideoSources中未定义的
我跟随firespace的教程,这是一个电子教程,我得到的信息说这是一个错误,尽管教程没有 未捕获(承诺中)TypeError:无法读取未定义的属性“buildFromTemplate” 在HTMLButtonElement.getVideoSources 此代码来自教程github中的源文件 你能帮忙或修理一下吗,谢谢Javascript 未捕获(承诺中)类型错误:无法读取属性';buildFromTemplate';HtmlButtoneElement.getVideoSources中未定义的,javascript,html,electron,desktop-application,Javascript,Html,Electron,Desktop Application,我跟随firespace的教程,这是一个电子教程,我得到的信息说这是一个错误,尽管教程没有 未捕获(承诺中)TypeError:无法读取未定义的属性“buildFromTemplate” 在HTMLButtonElement.getVideoSources 此代码来自教程github中的源文件 你能帮忙或修理一下吗,谢谢 const {remote} = require("electron"); const {dialog, Menu} = remote; 不是 我相信您正
const {remote} = require("electron");
const {dialog, Menu} = remote;
不是
我相信您正在使用较新版本的Electron,您需要创建这样的BrowserWindow
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
}
})
由于不允许在渲染器上使用
remote
,因此从v9默认情况下,enableMoteModuel
为false
,您的电子版本是什么?当您在渲染器上使用node_moduels
时。创建BrowserWindow时应启用节点集成:true
,我已经使用了该代码,但响应更改为“未捕获类型错误:无法破坏远程”的“属性”对话框,因为它未定义。在render.js:5”是否已启用此节点集成?在创建浏览器窗口时,还需要设置enablemotemodule:true
const dialog = remote;
const Menu = remote;
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true
}
})