使用 Electron-builder 构建 Electronjs 应用程序时,包含另一个 NodeJS 应用程序(通过 child_process 运行)
- 我有一个 Electronjs 应用程序,它通过
child_process
运行 NodeJS 应用程序,它创建一个 JSON 文件作为输出,并且该 JSON 文件通过 IPC 发送到客户端。
它在开发中按预期工作模式。但是,如果使用 Electron-builder 构建此 electrojs 应用程序,则它不包含该 Nodejs 应用程序,因此我收到一条错误消息,提示no such file or directory open ${timestamp}.json
(此文件应由该 Nodejs 应用程序创建)。
- 这是项目结构
- 一些代码示例是 这里,
{
"name": "electron-ipc",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder -w -c.extraMetadata.main=main.js"
},
"extraFiles": [
"anotherNodeJsApp"
],
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^17.1.2",
"electron-builder": "^22.14.13"
}
}
- I have an electronjs app that is run a nodejs app via
child_process
and it creates a JSON file as output and this JSON file is being sent to the client via IPC.
It working as expected in development mode. But if build this electronjs app usingelectron-builder
it's not included that nodejs app, so I'm getting an error saysno such file or directory open ${timestamp}.json
(This file should be created by that nodejs app).
- Here is the project structure
- Some code example is here,
{
"name": "electron-ipc",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder -w -c.extraMetadata.main=main.js"
},
"extraFiles": [
"anotherNodeJsApp"
],
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^17.1.2",
"electron-builder": "^22.14.13"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论