一、相关设置
系统环境变量:ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/
二、初始化
1、vue init simulatedgreg/electron-vue mplat-client
原项目electron版本太低,进行升级
cd mplat-client
2、npm uninstall electron
3、npm install electron --save-dev
4、npm install serialport --save
5、npm install
6、src/main/index.js
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
backgroundColor: "#ccc",
webPreferences: {
nodeIntegration: true, // to allow require
contextIsolation: false, // allow use with Electron 12+
webSecurity: false
}
})
7、npm uninstall vuex-electron
6、npm run dev
报错:Electron failed to install correctly, please delete node_modules/electron and try installing again
解决:cd node_modules/electron
node install.js
报错:http://localhost:9080/__webpack_hmr 404 (Not Found)
解决:.electron-vue/dev-runner.js第67、69行
hot: true, 添加注释:// hot: true,
app.use(ho