Forge 内部发生了未经处理的拒绝:
Error: Cannot make for rpm, the following external binaries need to be installed: rpmbuild
at MakerRpm.ensureExternalBinariesExist (/home/chris/repos/dvdplayer/node_modules/@electron-forge/maker-base/src/Maker.ts:147:13)
at _default (/usr/lib/node_modules/@electron-forge/cli/node_modules/@electron-forge/core/src/api/make.ts:135:11)
at /usr/lib/node_modules/@electron-forge/cli/src/electron-forge-make.ts:44:5
Electron Forge was terminated. Location:
{}
Run Code Online (Sandbox Code Playgroud)
运行命令时,我不断收到此错误消息。不知道该怎么办。
我有一个让我的应用程序正常工作所需的文件。
我可以通过指定固定路径在开发中使用该文件
var path = process.cwd() + '/src/app/components/task/Scripts';
Run Code Online (Sandbox Code Playgroud)
以及后面的文件名。但是在打包应用程序后,我想将我需要的文件移动到extraResources
系统中的文件夹中,我将能够在其中使用它
let path = pathPackage.join(process.resourcesPath, 'extraResources');
Run Code Online (Sandbox Code Playgroud)
我正在使用 Electron-Forge Maker 来生成生产构建 exe。extraResources
但是安装exe后并没有创建文件夹。
package.json
我在文件中指定它
"build": {
"extraResources": [
"./extraResources/**"
]
}
Run Code Online (Sandbox Code Playgroud)
有人可以为此提供解决方案吗?我已经测试了所有示例,但没有一个起作用。
我目前正在使用 Electron(-forge) 为 Mac、Linux 和 Windows 构建一个跨平台应用程序。我使用的是 Mac,并且npm run make
该应用程序是为 Mac 打包和构建的。
有没有什么方法(构建命令中的标志或其他东西)可以在Mac上为Linux和Windows构建应用程序?
预先感谢您的任何帮助!
我按照Electron Forge 页面安装了 Electron 的模板。
\nnpx create-electron-app my-new-app --template=typescript-webpack\n
Run Code Online (Sandbox Code Playgroud)\n之后,我跑
\nnpm run start\n
Run Code Online (Sandbox Code Playgroud)\ninsidesmy-new-app
文件夹,命令窗口中弹出以下错误消息
$ npm run start\n\n> my-new-app@1.0.0 start\n> electron-forge start\n\n\xe2\x9c\x94 Checking your system\n\xe2\x9c\x94 Locating Application\n\nAn unhandled rejection has occurred inside Forge:\nError: Expected plugin to either be a plugin instance or a { name, config } object but found @electron-forge/plugin-webpack,[object Object]\n\nElectron Forge was terminated. Location:\n{}\n
Run Code Online (Sandbox Code Playgroud)\n我用 Google 搜索,但没有人遇到相同的错误。\n一周前我可以使用上面的模板而不会出现错误消息。因此,我复制了一周前制作的项目并运行。这是成功的。但是,我运行以下命令
\nnpm audit\n
Run Code Online (Sandbox Code Playgroud)\n有 22 个漏洞(3 个中等,19 个高)。\n错误是
\ngot <11.8.5 …
Run Code Online (Sandbox Code Playgroud) 我刚刚使用以下命令创建了一个新应用程序:
npx create-electron-app my-new-app --template=typescript-webpack
Run Code Online (Sandbox Code Playgroud)
在renderer.ts 中,我添加了以下代码
import "./index.css";
import { ipcRenderer } from "electron";
Run Code Online (Sandbox Code Playgroud)
但是当我运行npm run start 时,浏览器控制台中出现以下错误
Uncaught ReferenceError: require is not defined
Run Code Online (Sandbox Code Playgroud)
更新 我尝试过的内容:
webpack.plugins.js
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const webpack = require("webpack");
module.exports = [
new ForkTsCheckerWebpackPlugin(),
new webpack.ExternalsPlugin("commonjs", ["electron"]),
];
Run Code Online (Sandbox Code Playgroud)
但它仍然不起作用。
我正在尝试对电子进行反应,尽管我遵循了该网站的说明:https ://dev.to/mandiwise/electron-apps-made-easy-with-create-react-app-and-电子铸造-560e
和这个网站(图标):https ://chasingcode.dev/blog/electron-generate-mac-windows-app-icons
每当我运行 npm run make 时都会出现此错误
$ npm run make
> electronforge@0.1.0 make C:\StandaloneApps\electronforge
> react-scripts build && electron-forge make
these parameters are deprecated, see docs for addKeyword
these parameters are deprecated, see docs for addKeyword
these parameters are deprecated, see docs for addKeyword
C:\StandaloneApps\electronforge\node_modules\ajv-keywords\keywords\_formatLimit.js:63
var format = formats[date]
^
TypeError: Cannot read property 'date' of undefined
at extendFormats (C:\StandaloneApps\electronforge\node_modules\ajv-keywords\keywords\_formatLimit.js:63:25)
at defFunc (C:\StandaloneApps\electronforge\node_modules\ajv-keywords\keywords\_formatLimit.js:54:5)
at defineKeywords (C:\StandaloneApps\electronforge\node_modules\ajv-keywords\index.js:17:22)
at Object.<anonymous> (C:\StandaloneApps\electronforge\node_modules\schema-utils\dist\validate.js:64:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) …
Run Code Online (Sandbox Code Playgroud) Electron 应用程序是使用 electro-forge webpack 模板初始化的,一切都适用于 macOS。当使用Electron-forge启动运行开发版本时,该应用程序可以在 Windows 上完美加载。使用Electron-forge将应用程序打包为 Windows 后,构建即可成功完成。但是在运行打包的应用程序时会抛出 Cannot find module X。文件夹./out/app/resources/app/node_modules为空。package.json ./out/app/resources/app/package.json如下所示。
"name": "my-app",
"productName": "my-app",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "",
"email": ""
},
"license": "MIT",
"config": {},
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},
"peerDependencies": {}
}
Run Code Online (Sandbox Code Playgroud)
源 …
我正在尝试删除或覆盖由电子制作的通知签名。
我正在尝试是否覆盖签名 electro.app.Electron 还是完全删除它,因为我知道我已经在测试模式(npm run start
)下对其进行了测试,并且在打包时.exe
我也注意到我删除了图标,签名会出现问题,但是没有一个就很不愉快了。
我当前的通知代码如下:
function showNotification() {
const notification = new Notification("new message", {
body: "app launched",
icon: __dirname + '/icon.ico',
tag: 'soManyNotification',
hasReply: true
})
}
console.log(Notification.permission)
if (Notification.permission === "granted") {
showNotification()
//alert('we have permission');
} else if (Notification.permission === "denied") {
Notification.requestPermission()
};
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激^^
在使用时编辑电子应用程序(在Mac上)时,有人可以告诉我使用自定义图标的说明electron-forge package
吗?使用--icon
给我一个错误:
error: unknown option `--icon'
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
在某些模块中有效@vercel/webpack-asset-relocator-loader
,在某些模块中无效。如果它不起作用,我必须使用此处的 electro-forge 文档中所述的外部配置。
如果资产重定位加载器不适用于您的本机模块,您可能需要考虑使用外部配置
所以最终发生的事情是我将模块放入外部配置中,如下所示:
// webpack.main.config.js
module.exports = {
// other webpack configs
externals: {
'active-win': 'commonjs2 active-win',
iohook: 'commonjs2 iohook',
'screenshot-desktop': 'commonjs2 screenshot-desktop',
},
};
Run Code Online (Sandbox Code Playgroud)
其作用是,每当使用这些模块时,它都会搜索 node_modules 文件夹。这在开发中有效,但应用程序打包后,node_modules 文件夹为空。
我尝试使用@timfish/forge-externals-plugin库,但它不适用于我使用的某些模块。
那么如何才能使 node_modules 文件夹包含在打包的应用程序中呢?我不确定这是电子配置还是 webpack 配置或两者兼而有之。谢谢...
electron ×10
electron-forge ×10
node.js ×5
javascript ×4
reactjs ×2
webpack ×2
build ×1
typescript ×1