如何部署 Electron React 样板应用程序?
Posted
技术标签:
【中文标题】如何部署 Electron React 样板应用程序?【英文标题】:How to Deploy Electron React Boilerplate App? 【发布时间】:2021-10-23 08:20:09 【问题描述】:我制作了一个 React Electron 应用程序,但我很难部署这个 Electron React Boilerplate 应用程序(制作一个 .exe 文件)我使用这个 Boilerplate:https://github.com/Jerga99/electron-react-boilerplate?
我的 package.json 文件如下所示:
"name": "electron-react-app",
"version": "1.0.0",
"description": "",
"main": "y",
"scripts":
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --config webpack.common.js --watch",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
,
"keywords": [],
"author": "",
"license": "ISC",
"dependencies":
"electron-compile": "^6.4.4",
"electron-squirrel-startup": "^1.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1"
,
"devDependencies":
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"babel-loader": "^8.1.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"css-loader": "^4.3.0",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "8.2.0",
"electron-reload": "^1.5.0",
"sass": "^1.26.11",
"sass-loader": "^10.0.2",
"style-loader": "^1.2.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
,
"config":
"forge":
"make_targets":
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
,
"electronPackagerConfig":
"packageManager": "npm"
,
"electronWinstallerConfig":
"name": "electron_react_app"
,
"electronInstallerDebian": ,
"electronInstallerRedhat": ,
"github_repository":
"owner": "",
"name": ""
,
"windowsStoreConfig":
"packageName": "",
"name": "electronreactapp"
我尝试使用 Electron frog,但出现此错误:
有人知道我做错了什么或建议另一种方式来部署这个电子应用程序吗?
非常感谢
【问题讨论】:
【参考方案1】:您可以尝试使用 Electron builder 而不是 electron forge。 https://www.electron.build/
另外,您使用的样板只有 2 次提交,这意味着它没有被维护。所以样板本身可能有错误。
我建议你使用这个反应样板:https://github.com/electron-react-boilerplate/electron-react-boilerplate
【讨论】:
以上是关于如何部署 Electron React 样板应用程序?的主要内容,如果未能解决你的问题,请参考以下文章