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

相关推荐
格子软件1 小时前
2026年GEO优化系统源码的分布式状态机深度拆解
java·前端·vue.js·vue·geo
摇滚侠2 小时前
方法 A 等方法 B 执行完再执行 叫同步调用还是异步调用 JS 默认是同步调用还是异步调用
开发语言·javascript·ecmascript
格子软件2 小时前
2026年GEO优化系统源码解构:核心状态机与高并发流控深度剖析
java·vue.js·spring boot·vue·geo
触底反弹3 小时前
🔥 字符串算法面试三连击:反转、回文、回文变种,搞懂这三题稳了!
前端·javascript·算法
触底反弹3 小时前
AI Tool Use 深度解析:大模型是如何"突破物理限制"调用外部工具的?
javascript·人工智能·后端
竹林8183 小时前
从 RPC 超时到批量签名:我用 @solana/web3.js 重构了一个 NFT 铸造页面,踩了这些坑
前端·javascript
优雅格子衫3 小时前
TypeScript 类的基本使用小结
javascript·ubuntu·typescript
橘子星3 小时前
从零手写 RAG 语义检索:基于 Node.js 实现轻量级向量搜索
javascript·人工智能
林希_Rachel_傻希希4 小时前
web性能优化之————图片效果
前端·javascript·面试
橘子星4 小时前
基于 MCP 协议实现本地文件读取工具服务开发实践
javascript·人工智能