{"id":1153,"date":"2022-11-01T09:38:17","date_gmt":"2022-11-01T01:38:17","guid":{"rendered":"https:\/\/fdream.net\/blog\/?p=1153"},"modified":"2022-11-02T12:29:16","modified_gmt":"2022-11-02T04:29:16","slug":"electron%e5%9c%a8macos%e4%b8%8a%e6%89%93%e5%8c%85windows-exe%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/1153","title":{"rendered":"Electron\u5728macOS\u4e0a\u6253\u5305windows exe\u6587\u4ef6"},"content":{"rendered":"\n<p>\u8bd5\u7740\u73a9\u4e00\u4e0bElectron\uff0c\u5728macOS 12\/13\u4e0a\u6253\u5305exe\u6587\u4ef6\u65f6\uff0c\u8e29\u4e86\u597d\u51e0\u4e2a\u5751\uff0c\u505a\u4e2a\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p>\u6253\u5305\u5de5\u5177\u4f7f\u7528\u7684\u662f<a rel=\"noreferrer noopener\" href=\"https:\/\/www.electronjs.org\/zh\/docs\/latest\/tutorial\/quick-start#%E6%89%93%E5%8C%85%E5%B9%B6%E5%88%86%E5%8F%91%E6%82%A8%E7%9A%84%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F\" target=\"_blank\">Electron\u5feb\u901f\u5165\u95e8<\/a>\u6559\u7a0b\u91cc\u9762\u63a8\u8350\u7684&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.electronforge.io\/\" target=\"_blank\">Electron Forge<\/a>\uff0c\u5728macOS\u4e0a\u6253\u5305exe\u6587\u4ef6\uff0c\u9700\u8981\u4f9d\u8d56\u51e0\u4e2a\u5de5\u5177\uff1awine\u3001mono\u3001xquartz\uff0c\u5206\u522b\u5b89\u88c5\u3002\u7136\u540e\u6267\u884c\u6253\u5305\u547d\u4ee4\uff0c\u53d1\u73b0\u4f1a\u5361\u5728\u8fd9\u4e2a\u5730\u65b9\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>We need to package your application before we can make it\n\u221a Preparing to Package Application for arch: x64\n\u221a Compiling Application\n\u221a Preparing native dependencies\n\u221a Packaging Application\nMaking for the following targets:\n\u00d7 Making for target: squirrel - On platform: win32 - For arch: x64<\/code><\/pre>\n\n\n\n<p>\u6b64\u65f6\uff0c\u66f4\u6539<code>forge.config.js<\/code>\u4e2d\u7684<code>packgerConfig<\/code>\u4e2d\u7684\u4e00\u4e2a\u914d\u7f6e\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>packagerConfig: {\n  ...\n  \"asar\":\"true\"\n},<\/code><\/pre>\n\n\n\n<p>\u518d\u6b21\u5c1d\u8bd5\uff0c\u53c8\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Error {\n    message: `Failed with exit code: 255\n\n    Output:\n    System.AggregateException: One or more errors occurred. () ---> System.Exception\n      at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) &#91;0x00119] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n       --- End of inner exception stack trace ---\n      at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) &#91;0x00011] in &lt;b6f643ae6ccb410db69142d5eaf9b9c1>:0 \n      at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) &#91;0x00043] in &lt;b6f643ae6ccb410db69142d5eaf9b9c1>:0 \n      at System.Threading.Tasks.Task.Wait () &#91;0x00000] in &lt;b6f643ae6ccb410db69142d5eaf9b9c1>:0 \n      at Squirrel.ReleasePackage.CreateReleasePackage (System.String outputFile, System.String packagesRootDir, System.Func`2&#91;T,TResult] releaseNotesProcessor, System.Action`1&#91;T] contentsPostProcessHook) &#91;0x001f7] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n      at Squirrel.Update.Program.Releasify (System.String package, System.String targetDir, System.String packagesDir, System.String bootstrapperExe, System.String backgroundGif, System.String signingOpts, System.String baseUrl, System.String setupIcon, System.Boolean generateMsi, System.String frameworkVersion, System.Boolean generateDeltas) &#91;0x00214] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n      at Squirrel.Update.Program.executeCommandLine (System.String&#91;] args) &#91;0x004a2] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n      at Squirrel.Update.Program.main (System.String&#91;] args) &#91;0x00082] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n      at Squirrel.Update.Program.Main (System.String&#91;] args) &#91;0x00006] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 \n    ---> (Inner Exception #0) System.Exception\n      at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) &#91;0x00119] in &lt;a5ee691170b94c488950c75951ce1ba3>:0 &lt;---\n    `,\n  }<\/code><\/pre>\n\n\n\n<p>\u770b\u8d77\u6765\u662fSquirrel\u91cc\u9762\u51fa\u73b0\u4e86\u9519\u8bef\uff0c\u627e\u5230\u4e00\u4e2a<a href=\"https:\/\/github.com\/Squirrel\/Squirrel.Windows\/issues\/1605#issuecomment-1101862417\" target=\"_blank\" rel=\"noreferrer noopener\">issue<\/a>\uff0c\u5c1d\u8bd5\u4e86\u4e00\u4e0b\u91cc\u9762\u7684\u65b9\u6cd5\uff0c\u6210\u529f\u89e3\u51b3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew uninstall --cask xquartz\nbrew uninstall --cask wine-stable\n\nbrew tap gcenx\/wine\nbrew install --cask --no-quarantine wine-crossover<\/code><\/pre>\n\n\n\n<p>macOS\u4e0d\u518d\u652f\u6301<code>Squirrel.Windows<\/code>\uff0c\u8fd9\u4e2a\u80fd\u8dd1\u8d77\u6765\u5e94\u8be5\u4e5f\u53ea\u662f\u6682\u65f6\u7684\uff0c\u4ee5\u540e\u6253\u5305\u53ef\u80fd\u8fd8\u662f\u9700\u8981\u4e2awindows\u7cfb\u7edf\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bd5\u7740\u73a9\u4e00\u4e0bElectron\uff0c\u5728macOS 12\/13\u4e0a\u6253\u5305exe\u6587\u4ef6\u65f6\uff0c\u8e29\u4e86\u597d\u51e0\u4e2a\u5751\uff0c\u505a\u4e2a\u8bb0\u5f55\u3002 \u6253\u5305\u5de5\u5177\u4f7f\u7528\u7684\u662fElectron\u5feb\u901f\u5165\u95e8\u6559\u7a0b\u91cc\u9762\u63a8\u8350\u7684&nbsp;Electron Forge\uff0c\u5728macOS\u4e0a\u6253\u5305exe\u6587\u4ef6\uff0c\u9700\u8981\u4f9d\u8d56\u51e0\u4e2a\u5de5\u5177\uff1awine\u3001mono\u3001xquartz\uff0c\u5206\u522b\u5b89\u88c5\u3002\u7136\u540e\u6267\u884c\u6253\u5305\u547d\u4ee4\uff0c\u53d1\u73b0\u4f1a\u5361\u5728\u8fd9\u4e2a\u5730\u65b9\uff1a \u6b64\u65f6\uff0c\u66f4\u6539forge.config.js\u4e2d\u7684packgerConfig\u4e2d\u7684\u4e00\u4e2a\u914d\u7f6e\u5373\u53ef\uff1a \u518d\u6b21\u5c1d\u8bd5\uff0c\u53c8\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a \u770b\u8d77\u6765\u662fSquirrel\u91cc\u9762\u51fa\u73b0\u4e86\u9519\u8bef\uff0c\u627e\u5230\u4e00\u4e2aissue\uff0c\u5c1d\u8bd5\u4e86\u4e00\u4e0b\u91cc\u9762\u7684\u65b9\u6cd5\uff0c\u6210\u529f\u89e3\u51b3\uff1a macOS\u4e0d\u518d\u652f\u6301Squirrel.Windows\uff0c\u8fd9\u4e2a\u80fd\u8dd1\u8d77\u6765\u5e94\u8be5\u4e5f\u53ea\u662f\u6682\u65f6\u7684\uff0c\u4ee5\u540e\u6253\u5305\u53ef\u80fd\u8fd8\u662f\u9700\u8981\u4e2awindows\u7cfb\u7edf\u4e86\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[371],"class_list":["post-1153","post","type-post","status-publish","format-standard","hentry","category-coding","tag-electron"],"views":1109,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/1153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=1153"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/1153\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=1153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=1153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=1153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}