Electron+Vue3+TS+sqlite3项目搭建加入sqlite3后无法运行问题

加入sqlite3测试代码后页面出现数不清的报错,这是因为vue配置中没有添加node支持

找到文件vue.config.js:4:1

// exports对象中加入配置


pluginOptions:{

electronBuilder:{

nodeIntegration:true

}

}


package.json


{

"name": "project",

"version": "0.1.0",

"private": true,

"scripts": {

"serve": "vue-cli-service serve",

"build": "vue-cli-service build",

"lint": "vue-cli-service lint",

"electron:build": "vue-cli-service electron:build",

"electron:serve": "vue-cli-service electron:serve",

"postinstall": "electron-builder install-app-deps",

"postuninstall": "electron-builder install-app-deps"

},

"main": "background.js",

"dependencies": {

"@types/sqlite3": "^3.1.8",

"core-js": "^3.8.3",

"sqlite3": "^5.0.0",

"vue": "^3.2.13",

"vue-router": "^4.0.3",

"vuex": "^4.0.0"

},

"devDependencies": {

"@types/electron-devtools-installer": "^2.2.0",

"@typescript-eslint/eslint-plugin": "^5.4.0",

"@typescript-eslint/parser": "^5.4.0",

"@vue/cli-plugin-babel": "~5.0.0",

"@vue/cli-plugin-eslint": "~5.0.0",

"@vue/cli-plugin-router": "~5.0.0",

"@vue/cli-plugin-typescript": "~5.0.0",

"@vue/cli-plugin-vuex": "~5.0.0",

"@vue/cli-service": "~5.0.0",

"@vue/eslint-config-typescript": "^9.1.0",

"electron": "^13.0.0",

"electron-devtools-installer": "^3.1.0",

"eslint": "^7.32.0",

"eslint-plugin-vue": "^8.0.3",

"sass": "^1.32.7",

"sass-loader": "^12.0.0",

"ts-loader": "^8.2.0",

"typescript": "~4.5.5",

"vue-cli-plugin-electron-builder": "~2.1.1"

}

}

参考链接:【Electron + Vue3 + TS + sqlite3项目搭建 - 杜柯枫 - 博客园】https://www.cnblogs.com/dkf717/p/17226481.html?_refluxos=a10

相关推荐
要加油哦~20 分钟前
JS | 知识点总结 - 原型链
开发语言·javascript·原型模式
Q_Q51100828535 分钟前
python+uniapp基于微信小程序的旅游信息系统
spring boot·python·微信小程序·django·flask·uni-app·node.js
哆啦A梦15881 小时前
axios 的二次封装
前端·vue.js·node.js
阿珊和她的猫1 小时前
深入理解与手写发布订阅模式
开发语言·前端·javascript·vue.js·ecmascript·状态模式
Q_Q5110082851 小时前
python基于web的汽车班车车票管理系统/火车票预订系统/高铁预定系统 可在线选座
spring boot·python·django·flask·node.js·汽车·php
爱看书的小沐2 小时前
【小沐杂货铺】基于Three.js渲染三维风力发电机(WebGL、vue、react、WindTurbine)
javascript·vue.js·webgl·three.js·opengl·风力发电机·windturbine
qq_398586542 小时前
Threejs入门学习笔记
javascript·笔记·学习
浪裡遊3 小时前
Nivo图表库全面指南:配置与用法详解
前端·javascript·react.js·node.js·php
課代表3 小时前
JavaScript 二维数组的三种定义与初始化方法
javascript·初始化·二维数组·多维数组·动态数组·循环遍历·数组合并
鸡吃丸子4 小时前
Next.js 入门指南
开发语言·javascript·next.js