【发布时间】:2022-04-18 01:39:43
【问题描述】:
我进入 Electron 是为了尝试开始构建桌面应用程序。我遇到了这个错误:
/home/me/dev/my-electron-app-2/node_modules/electron/dist/electron exited with signal SIGTRAP
此路径指向一个二进制文件,因此我无法真正阅读正在发生的事情。当我运行时出现此错误:
npm start
我的目标是在我的桌面上出现一个反映 HTML 页面的窗口。到目前为止,该应用程序只是:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</body>
</html>
main.js
const { app, BrowserWindow } = require('electron')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
此代码来自文档,此处:https://www.electronjs.org/docs/latest/tutorial/quick-start
我已经用谷歌搜索了很多,但无法找到一个可行的解决方案。我在 WSL 中使用 Ubuntu。如果有人有任何建议,将不胜感激。
谢谢
【问题讨论】:
标签: javascript npm electron windows-subsystem-for-linux desktop-application