电子伪造使失败

时间:2017-11-11 13:09:18

标签: electron electron-forge

我的应用程序使用电子伪造包装失败,如下所示,我不知道是什么原因造成的:

"electronPackagerConfig": { "dir": "./src", "ignore": []

1 个答案:

答案 0 :(得分:1)

通过一个消除过程,我已经根据我的electronPackagerConfig忽略文件列表的内容追踪了问题

electron-forge make ✔ Checking your system ✔ Resolving Forge Config We need to package your application before we can make it ✔ Preparing to Package Application for arch: x64 ⠹ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/electron-main.js Couldn't find preset "env" relative to directory "/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src" ⠸ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/electron-prefix.js Couldn't find preset "env" relative to directory "/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src" Failed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/flow.html Couldn't find preset "env" relative to directory "/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src" ⠴ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/renderer.js Couldn't find preset "env" relative to directory "/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src" ✔ Compiling Application ✔ Preparing native dependencies ✔ Packaging Application Making for the following targets: ✔ Making for target: dmg - On platform: darwin - For arch: x64

如果忽略文件列表包含" lib",则会出现与此类似的错误: electron-forge make ✔ Checking your system ✔ Resolving Forge Config We need to package your application before we can make it ✔ Preparing to Package Application for arch: x64 ⠹ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/electron-main.js Cannot find module './targets-parser' (While processing preset: "/private/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/node_modules/babel-preset-env/lib/index.js") ⠸ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/electron-prefix.js Cannot find module './targets-parser' (While processing preset: "/private/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/node_modules/babel-preset-env/lib/index.js") Failed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/flow.html Cannot find module './targets-parser' (While processing preset: "/private/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/node_modules/babel-preset-env/lib/index.js") ⠴ Compiling ApplicationFailed to compile file: /var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/src/renderer.js Cannot find module './targets-parser' (While processing preset: "/private/var/folders/ld/v4nwzxnj7rq41_f08r5_clgw0000gn/T/electron-packager/darwin-x64/flow-darwin-x64/Electron.app/Contents/Resources/app/node_modules/babel-preset-env/lib/index.js") ✔ Compiling Application ✔ Preparing native dependencies ✔ Packaging Application Making for the following targets: ✔ Making for target: dmg - On platform: darwin - For arch: x64

如果你的忽略文件列表包含" target",那么你会得到这样的失败: "\\./target"

我尝试使用" ./ lib"和" ./ target"没有变化。

更仔细地阅读文档(https://github.com/electron-userland/electron-packager/blob/master/docs/api.md),所有这些字符串实际上是正则表达式,我认为它不会解释"。"作为CWD。

似乎逃避了"。"在正则表达式中避免它修复此问题:

{{1}}

现在的问题是这些子文件夹不会从我的包中排除。 我试图找到一个排除它们的正则表达式,但不会打破包装器。