Adding a Sqlite database
See original GitHub issueI’m trying to add a sqlite database to my electron app that’s based on this boilerplate, but having problems setting it up. I’m wondering what the recommended way is.
My first attempt was to use knex.js. For my use this requires npm installation of knex and sqlite3. However when I run the server, I’m met with a bunch of errors:
I don’t understand these errors. I’m not using the mariasql etc. drivers.
ERROR in ./~/knex/lib/dialects/maria/index.js
Module not found: Error: Cannot resolve module 'mariasql' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/knex/lib/dialects/maria
@ ./~/knex/lib/dialects/maria/index.js 29:11-30
ERROR in ./~/knex/lib/dialects/mysql/index.js
Module not found: Error: Cannot resolve module 'mysql' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/knex/lib/dialects/mysql
@ ./~/knex/lib/dialects/mysql/index.js 35:11-27
ERROR in ./~/knex/lib/dialects/mysql2/index.js
Module not found: Error: Cannot resolve module 'mysql2' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/knex/lib/dialects/mysql2
@ ./~/knex/lib/dialects/mysql2/index.js 33:11-28
ERROR in ./~/knex/lib/dialects/oracle/index.js
Module not found: Error: Cannot resolve module 'oracle' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/knex/lib/dialects/oracle
@ ./~/knex/lib/dialects/oracle/index.js 40:11-28
goes on for a while
My second attempt was to use Sql.js. Requiring only npm install sql.js.
Running the server gives the error:
ERROR in ./~/sql.js/js/sql.js
Module not found: Error: Cannot resolve module 'ws' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/sql.js/js
@ ./~/sql.js/js/sql.js 337:113-126 342:44-57
As an experiment, I try npm install --save ws. Low and behold it builds and I can get data from the sqlite file. But now I keep getting the warnings:
WARNING in ./~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/ws/lib
@ ./~/ws/lib/Validation.js 10:19-44
WARNING in ./~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in /home/shotor/Projects/playground/electron-react-boilerplate/node_modules/ws/lib
@ ./~/ws/lib/BufferUtil.js 10:19-40
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
SQLite Insert Into - Inserting New Rows Into a Table
SQLite INSERT – inserting a single row into a table · First, specify the name of the table to which you want to...
Read more >SQLite In 5 Minutes Or Less
At a shell or DOS prompt, enter: "sqlite3 test.db". This will create a new database named "test.db". (You can use a different name...
Read more >SQLite - CREATE Database - Tutorialspoint
SQLite - CREATE Database, In SQLite, sqlite3 command is used to create a new SQLite database. You do not need to have any...
Read more >Setup and Connect Local Database | SQLite - Prisma
Learn how to set up a SQLite database on Windows, macOS, and Linux by following the step-by-step instructions in this practical guide.
Read more >SQLite - Insert Data - Quackit Tutorials
To insert data into an SQLite database, use the INSERT statement. When you use this statement, you specify which columns to insert data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t know where I got this from, and also not 100% sure why it works. Something to do with excluding binaries. Try this:
Add to your
webpack.config.base
:edit: found where I got it from http://stackoverflow.com/questions/34912015/webpack-sequelize-sqlite3-error-cannot-find-module-sqlite3
externals must contain the upperCamel name; like ‘node_module’ to ‘nodeModule’