项目技术
vue-electron
vue-router
vuex
vuex-electron
element-ui
echarts
mysql
打包异常
Error: Unresolved node modules: vue
Error: Unresolved node modules: vue
at D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@app-builder-lib\src\util\packageDependencies.ts:112:21
at Generator.next (
at Generator.tryCatcher (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\util.js:16:23)
at PromiseSpawn._promiseFulfilled (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\generators.js:97:49)
at Promise._settlePromise (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:609:26)
at Promise._settlePromise0 (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:729:18)
at Promise._fulfill (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:466:57)
at Promise._settlePromiseFromHandler (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:559:17)
at Promise._settlePromise (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:604:18)
at Promise._settlePromises (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\promise.js:725:18)
From previous event:
at Promise.longStackTracesCaptureStackTrace [as _captureStackTrace] (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\debuggability.js:482:19)
at new PromiseSpawn (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\generators.js:43:17)
at D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@bluebird\js\release\generators.js:197:21
at Packager.build (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@app-builder-lib\src\packager.ts:288:14)
at build (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@app-builder-lib\src\index.ts:59:28)
at build (D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@electron-builder\src\builder.ts:228:10)
at D:\Code\Demo\Vue\Voice\App\node_modules\[email protected]@electron-builder\src\cli\cli.ts:49:19
可能是使用淘宝镜像的问题,把项目内 node_modules 文件夹内所有内容清除掉,然后使用 yarn install 重新下载。
Error: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
From previous event:
at CancellationToken.createPromise (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util-runtime\src\CancellationToken.ts:51:12)
at D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\nodeHttpExecutor.ts:23:44
From previous event:
at NodeHttpExecutor.download (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\out\nodeHttpExecutor.js:144:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\binDownload.ts:72:26
at Generator.next (
at processImmediate (internal/timers.js:461:21)
From previous event:
at doGetBin (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\out\binDownload.js:74:21)
at getBin (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\binDownload.ts:30:13)
at getTool (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\targets\tools.ts:118:10)
at getAppBuilderTool (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\targets\tools.ts:128:3)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:586:40
at Generator.next (
From previous event:
at WinPackager.resolveIcon (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:623:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:560:26
at Generator.next (
at WinPackager.getOrConvertIcon (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:594:11)
at Lazy.
at Lazy.get value [as value] (D:\Code\Demo\Vue\Voice\App\node_modules\lazy-val\src\main.ts:18:25)
at WinPackager.getIconPath (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:195:27)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:292:33
at Generator.next (
at WinPackager.signAndEditResources (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\winPackager.js:405:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:343:18
From previous event:
at WinPackager.getOrConvertIcon (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:594:11)
at Lazy.
at Lazy.get value [as value] (D:\Code\Demo\Vue\Voice\App\node_modules\lazy-val\src\main.ts:18:25)
at WinPackager.getIconPath (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:195:27)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:292:33
at Generator.next (
From previous event:
at WinPackager.signAndEditResources (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\winPackager.js:405:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:343:18
at Generator.next (
From previous event:
at WinPackager.signApp (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\winPackager.js:423:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:209:16
at Generator.next (
at processImmediate (internal/timers.js:461:21)
From previous event:
at WinPackager.doPack (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:276:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:113:16
at Generator.next (
From previous event:
at WinPackager.pack (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:196:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:364:24
at Generator.next (
at D:\Code\Demo\Vue\Voice\App\node_modules\fs-extra-p\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16
at callback (D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\polyfills.js:299:20)
at FSReqCallback.oncomplete (fs.js:184:5)
From previous event:
at Packager.doBuild (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:432:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:308:52
at Generator.next (
at D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\graceful-fs.js:144:16
at D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\graceful-fs.js:61:14
at FSReqCallback.oncomplete (fs.js:171:23)
From previous event:
at Packager._build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:376:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:270:23
at Generator.next (
From previous event:
at Packager.build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:332:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\builder.ts:310:40
at Generator.next (
From previous event:
at _build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\out\builder.js:61:21)
at build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\builder.ts:280:10)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\cli\cli.ts:48:33
at processImmediate (internal/timers.js:461:21)
From previous event:
at Object.runCommand (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\node_modules\yargs\lib\command.js:235:44)
at Object.get [as argv] (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\node_modules\yargs\yargs.js:965:21)
at Object.
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
electron-builder 版本问题,需要将 20.0 的版本降低到 "electron-builder": "^19.19.1" 。
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
From previous event:
at CancellationToken.createPromise (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util-runtime\src\CancellationToken.ts:51:12)
at D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\nodeHttpExecutor.ts:23:44
at Generator.next (
at processImmediate (internal/timers.js:461:21)
From previous event:
at NodeHttpExecutor.download (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\out\nodeHttpExecutor.js:144:11)
at Timeout._onTimeout (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\binDownload.ts:83:14)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
下载请求超时,注意报错的前两句:
downloading path=C:\Users\***\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.13 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.1.13/nsis-3.0.1.13.7z
cannot download: Error: read ECONNRESET path=C:\Users\***\AppData\Local\electron-builder\cache\nsis\nsis-3.0.1.13 attempt=1
说明在下载 nsis-3.0.1.13.7z 这个压缩包时连接超时,这时需要我们手动下载(直接浏览器打开:https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.1.13/nsis-3.0.1.13.7z)这个安装包放到指定文件夹: C:\Users\***\AppData\Local\electron-builder\cache\nsis\ 下面(如下图)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
From previous event:
at CancellationToken.createPromise (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util-runtime\src\CancellationToken.ts:51:12)
at D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\nodeHttpExecutor.ts:23:44
at Generator.next (
at processImmediate (internal/timers.js:461:21)
From previous event:
at NodeHttpExecutor.download (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\out\nodeHttpExecutor.js:144:11)
at Timeout._onTimeout (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\binDownload.ts:83:14)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
同样的问题,下载超时,注意前两句:
downloading path=C:\Users\PLS_01\AppData\Local\electron-builder\cache\nsis-resources\nsis-resources-3.3.0 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
cannot download: Error: read ECONNRESET path=C:\Users\PLS_01\AppData\Local\electron-builder\cache\nsis-resources\nsis-resources-3.3.0 attempt=1
处理办法如上
Error: Exit code: 1. Command failed: C:\Users\***\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.9.0\rcedit.exe D:\Code\Demo\Vue\Voice\App\build\win-unpacked\app.exe --set-version-string FileDescription app --set-version-string ProductName app --set-version-string LegalCopyright Copyright © 2021 *** --set-file-version 0.0.1 --set-product-version 0.0.1.0 --set-version-string InternalName app --set-version-string OriginalFilename --set-version-string CompanyName ***
--set-icon D:\Code\Demo\Vue\Voice\App\build\icons\icon.ico
Error: Exit code: 1. Command failed: C:\Users\***\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.9.0\rcedit.exe D:\Code\Demo\Vue\Voice\App\build\win-unpacked\app.exe --set-version-string FileDescription app --set-version-string ProductName app --set-version-string LegalCopyright Copyright © 2021 *** --set-file-version 0.0.1 --set-product-version 0.0.1.0 --set-version-string InternalName app --set-version-string OriginalFilename --set-version-string CompanyName ***
--set-icon D:\Code\Demo\Vue\Voice\App\build\icons\icon.ico
Fatal error: Unable to commit changes
Fatal error: Unable to commit changes
at D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\util.ts:122:16
at ChildProcess.exithandler (child_process.js:315:5)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
From previous event:
at exec (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\util.ts:85:3)
at execWine (D:\Code\Demo\Vue\Voice\App\node_modules\builder-util\src\wine.ts:60:12)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:326:11
From previous event:
at WinPackager.signAndEditResources (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\winPackager.js:405:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\winPackager.ts:343:18
at Generator.next (
From previous event:
at WinPackager.signApp (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\winPackager.js:423:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:209:16
at Generator.next (
at processImmediate (internal/timers.js:461:21)
From previous event:
at WinPackager.doPack (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:276:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\platformPackager.ts:113:16
at Generator.next (
From previous event:
at WinPackager.pack (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\platformPackager.js:196:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:364:24
at Generator.next (
at D:\Code\Demo\Vue\Voice\App\node_modules\fs-extra-p\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16
at callback (D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\polyfills.js:299:20)
at FSReqCallback.oncomplete (fs.js:184:5)
From previous event:
at Packager.doBuild (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:432:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:308:52
at Generator.next (
at D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\graceful-fs.js:144:16
at D:\Code\Demo\Vue\Voice\App\node_modules\graceful-fs\graceful-fs.js:61:14
at FSReqCallback.oncomplete (fs.js:171:23)
From previous event:
at Packager._build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:376:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\src\packager.ts:270:23
at Generator.next (
From previous event:
at Packager.build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder-lib\out\packager.js:332:11)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\builder.ts:310:40
at Generator.next (
From previous event:
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\builder.ts:310:40
at Generator.next (
From previous event:
at build (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\builder.ts:280:10)
at D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\cli\cli.ts:48:33
at processImmediate (internal/timers.js:461:21)
From previous event:
at Object.handler (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\src\cli\cli.ts:48:33)
at Object.runCommand (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\node_modules\yargs\lib\command.js:235:44)
at Object.parseArgs [as _parseArgs] (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\node_modules\yargs\yargs.js:1050:24)
at Object.get [as argv] (D:\Code\Demo\Vue\Voice\App\node_modules\electron-builder\node_modules\yargs\yargs.js:965:21)
at Object.
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
是因为项目没有配置 nsis ,在 package.json 下 的 build 中新增 nsis 配置:
"build": {
"nsis": {
"oneClick": false, // 是否一键安装
"allowElevation": true, // 允许请求提升。 如果为false,则用户必须使用提升的权限重新启动安装程序。
"allowToChangeInstallationDirectory": true, // 允许修改安装目录
"installerIcon": "./build/icons/aaa.ico",// 安装图标
"uninstallerIcon": "./build/icons/bbb.ico",//卸载图标
"installerHeaderIcon": "./build/icons/aaa.ico", // 安装时头部图标
"createDesktopShortcut": true, // 创建桌面图标
"createStartMenuShortcut": true,// 创建开始菜单图标
"shortcutName": "xxxx" // 图标名称
}
}
至此,成功打包,在项目 build 文件下可以看到一个 exe 安装包。
————————————————
版权声明:本文为CSDN博主「蜡笔小新历险记」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/muyoufansem/article/details/115068814