question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

These dependencies were not found where using knex with sqlite client

See original GitHub issue

Environment

Knex version: “knex”: “^0.20.11” Database + version: “sqlite3”: “^4.1.1” OS: Winows 10

Bug

  1. Explain what kind of behaviour you are getting and how you think it should do

I initialize a new Knex with client: “sqlite” but i get an error specifying that other dialect are missing:

My code

class Database  {
  constructor( pathToDbFile ) {
    this.knex = require('knex')({
      client: 'sqlite3',
      connection: {
        filename: pathToDbFile
      }
    }); 
  }
}
module.exports =  Database;
  1. Error message

These dependencies were not found:

  • mssql in ./node_modules/knex/lib/dialects/mssql/index.js
  • mssql/lib/base in ./node_modules/knex/lib/dialects/mssql/index.js
  • mssql/package.json in ./node_modules/knex/lib/dialects/mssql/index.js
  • mysql in ./node_modules/knex/lib/dialects/mysql/index.js
  • mysql2 in ./node_modules/knex/lib/dialects/mysql2/index.js
  • oracledb in ./node_modules/knex/lib/dialects/oracledb/index.js
  • pg in ./node_modules/knex/lib/dialects/postgres/index.js, ./node_modules/knex/lib/dialects/redshift/index.js
  • pg-query-stream in ./node_modules/knex/lib/dialects/postgres/index.js
  • tedious in ./node_modules/knex/lib/dialects/mssql/index.js

To install them, you can run: npm install --save mssql mssql/lib/base mssql/package.json mysql mysql2 oracledb pg pg-query-stream tedious
ERROR Build failed with errors. error Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

38reactions
Dahkenangnoncommented, Mar 15, 2020

If someone goes through here, here is the solution

//vue.config.js

module.exports = {
  transpileDependencies: ["vuetify"],
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
//Add also your database location
        extraResources: ['src/res/'] 
      },
 //This line: add knex and sqlite3
      externals: ['knex','sqlite3'],
    }
  }
};
0reactions
BroJenuelcommented, Aug 20, 2021

If someone goes through here, here is the solution

//vue.config.js

module.exports = {
  transpileDependencies: ["vuetify"],
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
//Add also your database location
        extraResources: ['src/res/'] 
      },
 //This line: add knex and sqlite3
      externals: ['knex','sqlite3'],
    }
  }
};

How to configure this in build, or in production mode. It seems that I cant make it work in production.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Cannot find module '@vscode/sqlite3' when running ...
It would appear that Knex is somehow expecting to find the Sqlite3 resources it needs inside of a node_modules/@vscode/sqlite3. Hence it is ......
Read more >
Installation | Knex.js
When you use the SQLite3 or Better-SQLite3 adapter, there is a filename ... This function receives no parameters, and returns either a configuration...
Read more >
knex - npm
A SQL query builder that is flexible, portable, and fun to use! A batteries-included, multi-dialect (PostgreSQL, MySQL, CockroachDB, MSSQL, ...
Read more >
knex | Yarn - Package Manager
A SQL query builder that is flexible, portable, and fun to use! A batteries-included, multi-dialect (PostgreSQL, MySQL, CockroachDB, MSSQL, SQLite3, ...
Read more >
Configuring Knex - DEV Community ‍ ‍
If we work with a SQLite database in our project, for instance, we would have a dependency on the knex module and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found