electron-vue发布(笔记)

本地下载运行

1、vue init simulatedgreg/electron-vue my-project
打包工具用的electron-builder
2、cd my-project
3、npm install
4、npm run dev (启动)

打包(各种坑)

执行npm run build
1、如果遇到类似报错

Error: Application entry file "dist\electron\main.js" in the "D:\wl\demo\build\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.
    at error (D:\gui\demo2\node_modules\electron-builder-lib\src\asar\asarFileChecker.ts:7:12)
    at D:\gui\demo2\node_modules\electron-builder-lib\src\asar\asarFileChecker.ts:33:11
    at Generator.next ()
    at callback (D:\gui\demo2\node_modules\graceful-fs\polyfills.js:299:20)
    at FSReqCallback.oncomplete (fs.js:177:5)

执行 npm install multispinner -D
然后在.electron-vue\build.js文件中引用
const Multispinner = require('multispinner')

2、打包时下载 electron-v.xxxx.zip 文件失败
解决方法:在 [淘宝镜像]下载对应版本文件,下载完成后放在
C:\Users\用户名\AppData\Local\electron\Cache 这个目录下

3、打包时下载 winCodeSign-v.xxx.7z、nsis-v.xxx.7z、nsis-resources-v.xxx.7z 文件失败
解决方法:在 [淘宝镜像]下载对应版本文件,下载完成后放在
① winCodeSign-v.xxx.7z 解压后存放到:C:\Users\Administrator\AppData\Local\electron-builder\Cache\winCodeSign
②nsis-v.xxx.7z 解压后存放到:C:\Users\用户名\AppData\Local\electron-builder\Cache\nsis
③ nsis-resources-v.xxx.7z 解压后存放到:C:\Users\用户名\AppData\Local\electron-builder\Cache\nsis

记录一下淘宝镜像地址(github下载太慢): https://npm.taobao.org/mirrors/electron-builder-binaries/
https://npm.taobao.org/mirrors/electron/

参考 https://www.hi917.com/detail/325.html
https://www.jianshu.com/p/ef7962a2edf6

你可能感兴趣的:(electron-vue发布(笔记))