electron-vue build的坑
2021-10-26 本文已影响0人
逸笛
1.Identifier 'tasks' has already been declared

原因:xxx标识符已经声明.
解决:不能用关键字、标识符命名,改名。
找到 项目根目录 .electron-vue/build.js修改下面代码,修改其中一对的tasks变量名,需要注意的是本文件中一共包含四个tasks,前两个是一对,后两个是一对,修改时请对应修改

2.Multispinner 类没有定义
UnhandledPromiseRejectionWarning: ReferenceError: Multispinner is not defined

原因:
我使用的是 electron -vue 的模板,在该模板中,没有引入 multispinner 相关的依赖,使用命令将 multispinner 依赖重新安装,并在 build.js 文件中加入引用。
解决:
npm install multispinner -D
build.js 文件中引用:
const Multispinner = require('multispinner')

3.take it away 'electron-builder' electron 打包失败

4.Cannot find module 'fs/promises'
解决:node升级大于v14 https://nodejs.org/zh-cn/
解决完bug,npm run build


