1.下载electron
electron/electron-quick-start: Clone to try a simple Electron app (github.com)
下载实例模板
2.安装依赖
npm源改成中国镜像
bash
npm config set registry https://registry.npmmirror.com
然后用cnpm i 来安装
npm换官方源
bash
npm config set registry https://registry.npmjs.org/
3.实例程序
javascript
const { app , BrowserWindow } = require('electron')
app.whenReady().then(() => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
})
mainWindow.loadURL("https://www.bilibili.com/")
})
4.配置nodemon
bash
"dev": "nodemon --exec electron ."