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

相关推荐
烂蜻蜓2 小时前
前端已死?什么是前端
开发语言·前端·javascript·vue.js·uni-app
Rowrey3 小时前
react+typescript,初始化与项目配置
javascript·react.js·typescript
谢尔登3 小时前
Vue 和 React 的异同点
前端·vue.js·react.js
祈澈菇凉7 小时前
Webpack的基本功能有哪些
前端·javascript·vue.js
小纯洁w7 小时前
Webpack 的 require.context 和 Vite 的 import.meta.glob 的详细介绍和使用
前端·webpack·node.js
记得早睡~8 小时前
leetcode150-逆波兰表达式求值
javascript·算法·leetcode
庸俗今天不摸鱼9 小时前
Canvas进阶-4、边界检测(流光,鼠标拖尾)
开发语言·前端·javascript·计算机外设
熬夜不洗澡9 小时前
Node.js中不支持require和import两种导入模块的混用
node.js
bubusa~>_<9 小时前
解决npm install 出现error,比如:ERR_SSL_CIPHER_OPERATION_FAILED
前端·npm·node.js
yanglamei19629 小时前
基于Python+Django+Vue的旅游景区推荐系统系统设计与实现源代码+数据库+使用说明
vue.js·python·django