Electron-vue: can not pack sequelize with sqlite3

Created on 27 Oct 2016  路  9Comments  路  Source: SimulatedGREG/electron-vue

webpack can not pack sequelize and sqlite3? how to solve this

question

Most helpful comment

After adding the sqlite3 package try running node_modules/.bin/install-app-deps.

All 9 comments

Sequelize (with sqlite3) is typically meant for back-end server processes and not meant for the front-end. Is there any specific reason why you would need this within the electron renderer scope?

Closing for now. Feel free to comment back.

@SimulatedGREG I can imagine that someone using node-sqlite3 as their client-side datastore (like Nylas/N1) would rather not write their sql queries directly and instead use an ORM. I'm not sure what specifically was @zhangmingze's issue, but in general, this isn't really uncommon when using Electron.

@SimulatedGREG I am also trying to use sequelize+sqlite in the boilerplate and I am facing this dependency error when running the tests:

WARNING in ./~/sequelize/lib/dialects/postgres/connection-manager.js Module not found: Error: Can't resolve 'pg' in '/Users/brunosiqueira/IgarapeDev/paraty-desktop/node_modules/sequelize/lib/dialects/postgres' @ ./~/sequelize/lib/dialects/postgres/connection-manager.js 22:14-27 @ ./~/sequelize/lib/dialects/postgres/index.js @ ./~/sequelize/lib/sequelize.js @ ./~/sequelize/index.js @ ./src/renderer/app/database/db_util.js @ ./src/renderer/app/database/person.spec.js @ ./src/renderer/app \.spec$ @ ./tests/unit/index.js

Have you seen this matter? sqlite is an important option other than the localstorage.
Thanks!

@brunosiqueira Did you use webpack?

if yes, try this

// webpack.config.js
externals: {
   "sequelize": "require('sequelize')"
 }

add this option maybe help you.

@zhangmingze that you for your help. It did help apparently. But now I am getting the sqlite3 error:

Electron 1.7.2 (Node 7.9.0) ERROR Uncaught Error: Please install sqlite3 package manually at webpack:///~/sequelize/lib/dialects/sqlite/connection-manager.js:25:0 <- index.js:111285

remind that the app already works, but not while testing. Requiring sqlite3 in the externals do not fix it.

After adding the sqlite3 package try running node_modules/.bin/install-app-deps.

After adding the sqlite3 package try running node_modules/.bin/install-app-deps.

This worked for me. I was getting ERROR Uncaught Error: Please install sqlite3 package manually as well.

My use case is that I launch express+sequelize+sqlite3 to have an API on localhost, so that a single renderer client can either connect to a local API or a remote API with the same code.

Worked to me @wotermelon :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexiej picture alexiej  路  3Comments

Oriol-GG picture Oriol-GG  路  3Comments

imomaliev picture imomaliev  路  3Comments

rodrigomata picture rodrigomata  路  3Comments

simdax picture simdax  路  3Comments