电子无法读取属性 getName of undefined

Electron cannot read property getName of undefined

本文关键字:getName of undefined 属性 读取      更新时间:2023-09-26

我在 http://electron.atom.io/docs/v0.36.5/api/menu/遵循电子菜单示例,但是我收到错误

Cannot read property 'getName' of undefined

这发生在调用require('electron').app.getName();的位置。

当我打开开发工具并查看时,我看到require('electron')似乎加载正确,但require('electron').app返回未定义。

我将假设您在主进程中执行此操作,如果是这样,您可能需要检查是否在某处安装了另一个electron模块,如常见问题解答中所述:https://github.com/atom/electron/blob/v0.36.6/docs/faq/electron-faq.md#requireelectronxxx-is-undefined