问题描述
我正在使用 Electron 和 Sequelize 构建应用程序.我开始配置我的数据库,然后,我收到了这个错误:
I'm building an application with Electron and Sequelize. I started to configure my database, then, I've received this error:
未捕获的错误:请手动安装 sqlite3 包在新的 ConnectionManager (/home/matheusdrdj/Documentos/Git/personal-管理/node_modules/sequelize/lib/dialects/sqlite/con…:31)在新的 SqliteDialect (/home/matheusdrdj/Documentos/Git/personal-管理/node_modules/sequelize/lib/dialects/sqlite/ind…:14)在新的 Sequelize (/home/matheusdrdj/Documentos/Git/personal-管理/node_modules/sequelize/lib/sequelize.js:239)在 eval (index.js?17a5:3)在对象.(renderer.js:1084)在 webpack_require (renderer.js:680)在 fn (renderer.js:90)在 eval (index.js?21f1:1)在对象.(renderer.js:1077)在 webpack_require (renderer.js:680)在 fn (renderer.js:90)在 eval (main.js?3b76:1)在对象.(renderer.js:918)在 webpack_require (renderer.js:680)在 fn (renderer.js:90)在对象.(renderer.js:835)在 webpack_require (renderer.js:680)在 renderer.js:726在 renderer.js:729
Uncaught Error: Please install sqlite3 package manually at new ConnectionManager (/home/matheusdrdj/Documentos/Git/personal- management/node_modules/sequelize/lib/dialects/sqlite/con…:31) at new SqliteDialect (/home/matheusdrdj/Documentos/Git/personal- management/node_modules/sequelize/lib/dialects/sqlite/ind…:14) at new Sequelize (/home/matheusdrdj/Documentos/Git/personal- management/node_modules/sequelize/lib/sequelize.js:239) at eval (index.js?17a5:3) at Object. (renderer.js:1084) at webpack_require (renderer.js:680) at fn (renderer.js:90) at eval (index.js?21f1:1) at Object. (renderer.js:1077) at webpack_require (renderer.js:680) at fn (renderer.js:90) at eval (main.js?3b76:1) at Object. (renderer.js:918) at webpack_require (renderer.js:680) at fn (renderer.js:90) at Object. (renderer.js:835) at webpack_require (renderer.js:680) at renderer.js:726 at renderer.js:729
我已经在全局和本地安装了 sqlite3,在控制台上对其进行了测试,它工作正常.但是,我的应用程序甚至没有加载屏幕.
I have installed sqlite3 globally and localy, tested it on the console and it's working fine. But, my application doesn't even load the screen.
我的依赖:
"dependencies": {
"axios": "^0.16.1",
"sequelize": "^4.37.7",
"sqlite3": "^4.0.0",
"vue": "^2.4.2",
"vue-electron": "^1.0.6",
"vue-router": "^2.5.3",
"vuetify": "1.0.0",
"vuex": "^2.3.1"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "0.1.2",
"cfonts": "^1.1.3",
"chalk": "^2.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^1.7.5",
"electron-builder": "^19.19.1",
"electron-debug": "^1.4.0",
"electron-devtools-installer": "^2.2.0",
"electron-rebuild": "^1.7.3",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"js-sha256": "^0.9.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"style-loader": "^0.18.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"url-loader": "^0.5.9",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2"
}
我不知道发生了什么.
推荐答案
使用 Electron sqlite3 必须使用 electron-builder 构建.
With Electron sqlite3 has to be built with electron-builder.
如何使用带电子的 sqlite3 模块?和 https://github.com/electron-userland/electron-builder两者都建议将其添加到您的 package.json
How to use sqlite3 module with electron?
and https://github.com/electron-userland/electron-builder
both recommend adding this to your package.json
"postinstall": "electron-builder install-app-deps"
这将在您每次安装新软件包时重建所有本机二进制文件.
This will rebuild all native binaries everytime you install a new package.
这篇关于Webpack 错误:请手动安装 sqlite3 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!