我正在尝试使用ElectronJs和AngularJS构建一个web桌面应用程序,所以当我启动桌面应用程序时,我编写了代码,一切工作正常,但在浏览器中,我遇到了一个问题--我有一个未定义的方法。
下面是我遇到问题的地方:
const electron = require('electron')
正如我在点击命令时所说的那样,一切工作正常:
electron .
但是当我在浏览器中打开我的文件index.html时,我在我的控制台中得到了这个错误
ReferenceError: require is not defined
我尝试了一些解决方案,比如导入“require.js”,
我有一个项目,我正在用电子做桌面应用程序,并使用React作为模板引擎。但我不知道如何打开一个新的屏幕来与电子作出反应。
这是我的项目的目录层次结构:
在我的主-> index.js中,我有以下代码,它是我的应用程序的init:
'use strict'
import { app, BrowserWindow, ipcMain } from 'electron'
import * as path from 'path'
import { format as formatUrl } from 'url'
import { N
在主窗口中,当单击按钮时,第二个/子窗口将通过ipc调用弹出。这是在第一次打开弹出窗口时起作用的。如果我关闭了弹出窗口并再次重新打开它,我将得到以下错误:
未察觉的异常:错误:对象在错误时(本机)在EventEmitter被销毁。(/home/xxxx/electron/fin/main.js:36:21)在emitOne (events.js:96:13) at EventEmitter.emit (events.js:188:7) at EventEmitter。(/home/xxxx/electron/fin/node_modules/electron-prebuilt/dist/re
我有问题的cy.visit挂在电子上,但铬是好的。在控制台中,cypress run没有错误,所以我想用electron来运行cypress open,但不确定如何运行。cypress open --browser electron或node_modules/cypress/bin/cypress open --browser node_modules/electron/dist/Electron.app/Contents/MacOS/Electron不起作用。 我已经尝试过cypress run --headed,但是cypress run不允许您中途停止测试并检查哪里出了问题。暂停测试将
我的renderer.js中有以下代码:
const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote;
function sendForm(event) {
event.preventDefault() // stop the form from submitting
let code = document.getElementById("code").value;
ipcRenderer.s
我正在研究一个电子应用程序,需要能够从我的网站检索默认操作系统浏览器上的localStorage。我怎样才能做到这一点呢?有没有什么API/模块?我是这样想的:
var electron = require("electron");
var storage = electron.OSBrowser.storage;
但我很确定那是不存在的。谢谢。(仅供参考,我在渲染器中,而不是主进程)
我已经安装了Cypress 5.0和所有的浏览器- Chrome,Edge和FF。当我跑的时候
> npx cypress open
无法在右上角看到所有浏览器。只有Electron在展示
我试过了
> npx cypress open --browser chrome
我得到以下错误
Can't run because you've entered an invalid browser name.
我有一个应用程序,我现在正在尝试构建,以分发测试。 我正在使用React和Electron with e-builder来构建应用程序本身。我不是一个网页开发人员,所以我一直在尝试保持基本的东西,只是让一些东西工作。 大约五个小时后,我终于能够让应用程序正常构建并启动,但当它加载index.js (应用程序中的第一个页面)时,它会显示index.js的源代码,而不是呈现内容。在devtools中,所有内容都在pre标记中。 我已经研究过this thread并尝试过了,但它并没有改变任何事情,而且据我所知,我没有使用服务工作者。 What the actual Electron window
我正在使用Vue CLI插件电子生成器,每当我试图使用import ipcRenderer from 'electron'在Vue组件中包含电子Module not found: Error: Can't resolve 'path' in '/Users/myname/IdeaProjects/project/node_modules/electron'时,我就会得到这个错误Module not found: Error: Can't resolve 'path' in '/Users/myname/Id
使用electron-builder构建电子应用程序后,我无法从dist文件夹中打开该应用程序。我确实更改了我所有的链接以使用path.join(__dirname,"relative_path/"),就像我在这里的一些答案中看到的那样。但即使打包过程成功,我也无法打开应用程序。 File structure for the electron app project 这是我的file structure的图像,这是项目的package.json文件 {
"name": "my_little_reminder",
"version
我有一个使用读写本地文件的create-react-app。当在浏览器(支持它的Chrome或Edge )中运行时,读取和写入文件都能正常工作。
当该应用程序在电子运行时,读取工作,但写入失败,因为:Uncaught (in promise) DOMException: The request is not allowed by the user agent or the platform in the current context.
我使用的是最新的Electron (12.0.1),它使用与我的Chrome浏览器中的相同的铬(89.0.4389.82)。
以下是相关代码。requestP
我正在尝试安装Selenium来测试我的电子应用程序。到目前为止,我有来自电子文档的代码,然而,这只是打开HTML文件,而不是我的实际应用程序。这是我的代码:
import * as path from "path";
const webdriver = require('selenium-webdriver');
const driver = new webdriver.Builder()
// The "9515" is the port opened by ChromeDriver.
.usingServer('