Webpack错误:请手动安装sqlite3包

时间:2018-05-09 20:00:06

标签: javascript webpack sqlite electron sequelize.js

我正在使用Electron和Sequelize构建一个应用程序。我开始配置我的数据库,然后,我收到了这个错误:

  

未捕获错误:请手动安装sqlite3包       在新的ConnectionManager(/ home / matheusdrdj / Documentos / Git / personal-)       管理/ node_modules / sequelize / lib中/方言/源码/ CON ...:31)       在新的SqliteDialect(/ home / matheusdrdj / Documentos / Git / personal-       管理/ node_modules / sequelize / lib中/方言/源码/ 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)       at fn(renderer.js:90)       在eval(index.js?21f1:1)       在对象。 (renderer.js:1077)       在 webpack_require (renderer.js:680)       at fn(renderer.js:90)       在eval(main.js?3b76:1)       在对象。 (renderer.js:918)       在 webpack_require (renderer.js:680)       at fn(renderer.js:90)       在对象。 (renderer.js:835)       在 webpack_require (renderer.js:680)       在renderer.js:726       在renderer.js:729

我已经在全局和localy上安装了sqlite3,在控制台上对它进行了测试,它运行正常。但是,我的应用程序甚至没有加载屏幕。

我的依赖项:

"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"
}

我无法弄清楚发生了什么。

1 个答案:

答案 0 :(得分:2)

使用Electron sqlite3必须使用电子构建器构建。

How to use sqlite3 module with electron?https://github.com/electron-userland/electron-builder 建议将此添加到package.json

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

每次安装新软件包时,这都将重建所有本机二进制文件。