在electron-vite项目中,使用本地数据库sqlite3,数据库文件test.db要放置在哪里? #641
Unanswered
superkamiu
asked this question in
Q&A
Replies: 1 comment
-
不应该包含在程序中,建议在安装后生成在程序数据目录或者其他位置。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我在开发electron-vite的项目中要使用本地数据库,我已将数据库文件test.db放置在resources文件夹里,在开发的时候,一切正常,但是当我使用npm run build:win后,在dist/win-unpacked文件夹里运行程序的时候,弹出错误,如下图:
我不知道这个错误要如何解决,请各位大佬帮忙解决一下,我的package.json的内容如下:
{
"name": "canyin4",
"version": "1.0.0",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "example.com",
"homepage": "https://electron-vite.org",
"scripts": {
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"start": "electron-vite preview",
"dev": "electron-vite dev --watch",
"build": "electron-vite build",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "npm run build && electron-builder --win",
"build:mac": "npm run build && electron-builder --mac",
"build:linux": "npm run build && electron-builder --linux"
},
"dependencies": {
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^3.0.0",
"@element-plus/icons-vue": "^2.3.1",
"better-sqlite3": "latest",
"bindings": "^1.5.0",
"element-plus": "^2.8.6",
"file-uri-to-path": "^2.0.0"
},
"devDependencies": {
"@electron-toolkit/eslint-config": "^1.0.2",
"@rushstack/eslint-patch": "^1.10.3",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^9.0.0",
"electron": "^31.0.2",
"electron-builder": "^24.13.3",
"electron-vite": "^2.3.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.26.0",
"prettier": "^3.3.2",
"unplugin-auto-import": "^0.18.3",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.3.1",
"vue": "^3.4.30"
}
}
Beta Was this translation helpful? Give feedback.
All reactions