{"id":934,"date":"2024-03-17T20:37:17","date_gmt":"2024-03-17T12:37:17","guid":{"rendered":"http:\/\/gjweb.top\/?p=934"},"modified":"2024-03-17T20:37:19","modified_gmt":"2024-03-17T12:37:19","slug":"electron-%e6%89%93%e5%8c%85%e5%90%8e%e6%8a%a5%e9%94%99%e4%be%9d%e8%b5%96%e4%b8%a2%e5%a4%b1","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=934","title":{"rendered":"electron \u6253\u5305\u540e\u62a5\u9519\u4f9d\u8d56\u4e22\u5931"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/gjweb.top\/wp-content\/uploads\/2024\/03\/d0a9758371440310e7388fe8c662532-1024x845.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"845\" data-original=\"http:\/\/gjweb.top\/wp-content\/uploads\/2024\/03\/d0a9758371440310e7388fe8c662532-1024x845.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-935\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p>\u5f53\u5728\u5f00\u53d1\u73af\u5883\u4e2d\u7f8e\u6ecb\u6ecb\u7684\u5199\u7740\u4ee3\u7801\uff0c\u4f46\u6253\u5305\u540e\u5374\u51fa\u4e0a\u9762\u7cdf\u5fc3\u7684\u4e00\u5e55\uff0c\u600e\u4e48\u529e\uff1f\u95ee\u4e86\u88ab\u5439\u4e0a\u5929\u7684 GPT \u8bf4\u662f\u56e0\u4e3a asar \u7684\u5bfc\u81f4\uff0c\u6211\u8bbe\u7f6e\u4e86 <code>asar:false<\/code>\uff0c\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff1b<\/p>\n\n\n\n<p>\u767e\u5ea6\u4e86\u8fd9\u4e2a\u9519\u8bef\uff0c\u5f88\u591a\u7684\u5e16\u5b50\u90fd\u8bf4\u56e0\u4e3a\u5f00\u53d1\u4e0d\u89c4\u8303\uff0c\u6ca1\u6709\u5c06\u4f9d\u8d56\u653e\u5230 <code>dependencies<\/code> \u6240\u4ee5\u4f1a\u51fa\u73b0\u4e0a\u9762\u95ee\u9898\uff1b\u4e8e\u662f\u4ea7\u751f\u81ea\u6211\u6000\u7591\u96be\u9053\u662f\u8fd9\u4e48\u4e0d\u89c4\u8303\u624d\u5f15\u53d1\u7684\u95ee\u9898\u5417? \u4f46\u662f\u5728\u6211\u7684\u4e1a\u52a1\u4ee3\u7801\u91cc\u9762\u5e76\u6ca1\u6709\u4f7f\u7528\u5230\u4e0a\u8ff0\u7f3a\u5931\u7684\u4f9d\u8d56<\/p>\n\n\n\n<p>\u7ecf\u5386\u4e86\u51e0\u4e2a\u5c0f\u65f6\u7684\u722c\u5751\u53d1\u73b0\uff0c\u4f7f\u7528 <code>electron-build<\/code> \u6253\u5305\u9879\u76ee\u53ea\u4f1a\u6253\u5305 <code>node_modules<\/code> \u4e2d\u7684\u4e00\u7ea7\u4f9d\u8d56, \u4f9d\u8d56\u7684\u4f9d\u8d56\u7531\u4e8e\u662f\u653e\u5230\u5b50\u6587\u4ef6\u4e2d, \u4ed6\u662f\u4e0d\u4f1a\u6253\u5305\u5230\u5e94\u7528\u4e2d\u7684\uff1b\u6839\u636e\u8fd9\u4e2a\u7ebf\u7d22\u53c8\u5728\u767e\u5ea6\u4e0a\u5bfb\u627e\u89e3\u51b3\u65b9\u6848\uff0c\u770b\u5230\u6709\u4eba\u8bf4\u53ef\u4ee5\u5199\u4e2a node \u811a\u672c\uff0c\u904d\u5386<code>node_modules<\/code>\u4e2d\u7684\u4f9d\u8d56\u4f9d\u6b21\u6dfb\u52a0\u5230 <code>dependencies<\/code>, \u770b\u5230\u8fd9\u4e2a\u6587\u7ae0\u6709\u4e86\u604d\u7136\u5927\u660e\u767d\u7684\u611f\u89c9; \u6839\u636e\u5b9e\u8df5\u8868\u660e\uff0c\u5c06\u904d\u5386\u4f9d\u8d56\u5230 <code>dependecies<\/code> \u4f1a\u51fa\u73b0 \u201c\u611a\u516c\u79fb\u5c71\u201d \u7684\u73b0\u8c61, \u4f9d\u8d56\u7684\u4f9d\u8d56\u7684\u4f9d\u8d56\u8fd8\u6709\u4f9d\u8d56&#8230;.. \u4f60\u4f1a\u53d1\u73b0\u5728\u65e0\u7a77\u65e0\u5c3d\u7684 <code>package.json<\/code> \u4e2d\u6dfb\u52a0\u4e1c\u897f\uff1b<\/p>\n\n\n\n<p>\u4e0a\u8ff0\u662f\u767e\u5ea6\u548cGPT\u63d0\u4f9b\u7684\u6240\u6709\u5173\u4e8e\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u5f88\u660e\u663e\u4ed6\u4eec\u53ea\u662f\u642c\u8fd0\u4e86\u8c23\u8a00;<\/p>\n\n\n\n<p><strong>\u53cd\u9a73\u4e00: \u4f9d\u8d56\u5f00\u53d1\u4e0d\u89c4\u8303,\u6ca1\u6709\u9075\u5faa\u5305\u7ba1\u7406\u7684 <code>--save-dev<\/code> \u548c <code>--save<\/code><\/strong><\/p>\n\n\n\n<p>\u5df2\u7ecf 2024 \u5e74\u4e86, \u524d\u7aef\u5de5\u7a0b\u5316\u5de5\u5177\u65e9\u5df2\u4e0d\u662f\u5200\u8015\u706b\u79cd\u7684\u65f6\u671f\u4e86, \u73b0\u5728\u4f7f\u7528\u811a\u624b\u67b6\u521b\u5efa\u9879\u76ee\uff0c\u5de5\u5177\u672c\u8eab\u5df2\u7ecf\u5f88\u597d\u7684\u533a\u5206\u4e86dev\u4f9d\u8d56\u548c save \u4f9d\u8d56\uff1b\u5f53\u4f60\u5728\u56e0\u4e3a\u4e1a\u52a1\u53bb\u5b89\u88c5\u4e00\u4e0b\u989d\u5916\u7684\u4f9d\u8d56\u65f6 99.99% \u90fd\u662f <code>dependecies<\/code> \u7684\u4f9d\u8d56\u3002\u56e0\u6b64\u80af\u672c\u4e0d\u5b58\u5728\u4f9d\u8d56\u5b89\u88c5\u4e0d\u89c4\u8303\uff0c\u9664\u975e\u6709\u4eba\u624b\u6b20\u7684\u6bcf\u6b21\u5b89\u88c5\u4f9d\u8d56\u90fd\u8981\u5728\u540e\u9762\u8ffd\u52a0\u4e00\u4e2a <code>--save-dev<\/code><\/p>\n\n\n\n<p><strong>\u53cd\u9a73\u4e8c\uff1a\u662felectron\u56e0\u4e3a asar \u673a\u5236\u5bfc\u81f4\u7684<\/strong><\/p>\n\n\n\n<p>\u88ab\u5439\u4e0a\u5929\u7684 GPT \u5f00\u59cb\u80e1\u8bf4\u516b\u9053\u4e86\uff0c\u4ec0\u4e48\u662f asar \uff1f \u603b\u7ed3\u6765\u8bf4 asar \u4f7f\u7528\u4f9d\u8d56\u538b\u7f29\u6280\u672f\uff0c\u7c7b\u4f3c\u4e0e<code>zip<\/code> \u538b\u7f29\u5305\uff0c\u5b83\u91cc\u9762\u538b\u7f29\u7684\u6587\u4ef6\u662f <code>node_modules<\/code> \u7684\u4e00\u7ea7\u4f9d\u8d56\u6587\u4ef6\uff0c\u5927\u5bb6\u4e5f\u53ef\u901a\u8fc7\u4e00\u4e9b\u65b9\u5f0f\u89e3\u538b\u770b\u5230\u4ed6\u7684\u539f\u59cb\u6587\u4ef6\uff0c\u65b9\u6cd5<\/p>\n\n\n\n<p>\u5b89\u88c5\u4f9d\u8d56<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -g asar<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b asar \u5305\u7684\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>asar xxx\/xxx.asar<\/code><\/pre>\n\n\n\n<p><strong>\u53cd\u9a73\u4e09\uff1a\u91c7\u7528 \u201c\u611a\u516c\u79fb\u5c71\u201d \u7684\u65b9\u5f0f\u5c06 node_modules \u7684\u4f9d\u8d56\u904d\u5386\u5230 package.json \u4e2d<\/strong><\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u6ca1\u6709\u529e\u6cd5\u7684\u529e\u6cd5\uff0c\u4f46\u4f1a\u5bfc\u81f4 package.json \u4fe1\u606f\u8fc7\u591a\uff0c\u539f\u56e0\u662f \u4f9d\u8d56\u7684\u4f9d\u8d56\u8fd8\u6709\u4f9d\u8d56\u3002\u3002\u3002\u3002\u65e0\u7a77\u5c3d\u4e5f<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\u90a3\u5230\u5e95\u5982\u4f55\u89e3\u51b3\u5462\uff1f<\/strong><\/p>\n\n\n\n<p>\u73b0\u5728\u95ee\u9898\u5c31\u662f node_modules \u6587\u4ef6\u7684\u5b58\u5728\u4e8c\u7ea7\u4f9d\u8d56\u7684\u6587\u4ef6\uff0c<code>electron_build<\/code> \u65e0\u6cd5\u6784\u5efa\uff0c<strong>\u4eb2\u6d4b\u662f\u53ef\u4ee5\u629b\u5f03\u5b98\u65b9\u63a8\u8350\u7684 npm \u5305\u7ba1\u7406\u5668\u4f7f\u7528 yarn<\/strong> \uff1b \u5f53\u4f60\u4f7f\u7528 yarn \u65f6\u91cd\u65b0 install &amp;&amp; build \u540e\u4f60\u53d1\u73b0\u6240\u6709\u7684\u95ee\u9898\u90fd\u4e0d\u5728\u5b58\u5728\uff1b\u539f\u56e0\u662f\u5565\uff1f<\/p>\n\n\n\n<p>\u56e0\u4e3a yarn \u5305\u7ba1\u7406\u5668\u5df2\u7ecf\u5c06 node_modules \u5305\u6241\u5e73\u5316\u7ba1\u7406\uff0c\u4e0d\u5b58\u4e8c\u7ea7\u4f9d\u8d56\u7684\u73b0\u8c61\u3002\u611f\u89c9 npm \u5f88\u50cf IE \u3002\u3002\u3002\u5b83\u5b58\u5728\u7684\u552f\u4e00\u7528\u5904\u5c31\u662f\u7528\u5b83\u5b89\u88c5\u522b\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002<\/p>\n\n\n\n<p><strong>\u5f53\u7136\u4f7f\u7528 yarn \u5305\u7ba1\u7406\u5de5\u5177\u65f6\uff0c\u5728 electron \u5b89\u88c5 <code>sqlite3 v5.1.7<\/code> \u548b\u4e5f\u88c5\u4e0d\u4e0a<\/strong>\uff0c\u5728\u5728\u5b98\u65b9\u7684 github \u4e2d\u53c8\u4e0d\u5c11\u9047\u5230\u540c\u6837\u7684\u95ee\u9898\uff0c\u5927\u5bb6\u4e00\u81f4\u7684\u8ba4\u4e3a <code>5.1.7<\/code> \u5b58\u5728\u95ee\u9898\uff0c\u4f46\u4f5c\u8005\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898\u7f6e\u4e4b\u4e0d\u7406\uff1b\u4e8e\u662f\u5c31\u964d\u5230\u4e86 <code>sqlite5.1.6<\/code> , \u5b89\u88c5\u540e\u8fd0\u884c sqlite \u5c31\u7f8e\u6ecb\u6ecb\u7684\u8fd0\u884c\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u5728\u5f00\u53d1\u73af\u5883\u4e2d\u7f8e\u6ecb\u6ecb\u7684\u5199\u7740\u4ee3\u7801\uff0c\u4f46\u6253\u5305\u540e\u5374\u51fa\u4e0a\u9762\u7cdf\u5fc3\u7684\u4e00\u5e55\uff0c\u600e\u4e48\u529e\uff1f\u95ee\u4e86\u88ab\u5439\u4e0a\u5929\u7684 GPT \u8bf4\u662f\u56e0\u4e3a asar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-934","post","type-post","status-publish","format-standard","hentry","category-electron"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=934"}],"version-history":[{"count":3,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/934\/revisions"}],"predecessor-version":[{"id":938,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/934\/revisions\/938"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}