New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix @vscode-sqlite3 error message #5081
Fix @vscode-sqlite3 error message #5081
Conversation
OlivierCavadenti
commented
Mar 21, 2022
- Fix the error message when sqlite3 driver don't exist.
- Relates Knex Throwing SQLITE3 error when SQLITE3 Is Installed, #5002
- If I remove my vscode/sqlite3 install, I have the error. If I reinstall it via "npm install @vscode/sqlite3 --save" it's ok for me. I miss something ?
- Fix the error message when sqlite3 driver don't exist. - Relates knex#5002
lib/client.js
Outdated
@@ -189,7 +189,11 @@ class Client extends EventEmitter { | |||
try { | |||
this.driver = this._driver(); | |||
} catch (e) { | |||
const message = `Knex: run\n$ npm install ${this.driverName} --save`; | |||
let driverName = this.driverName; | |||
if (driverName === 'sqlite3') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest more generic solution of driverName override map or, even better, make Client instances aware of their driverName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduce an alias driver name in sqlite3 index.js, I can't change the driver name by the way (is used by all tests that use testSql...).
By the way, I retest to delete the package, and run the command "npm install @vscode/sqlite3 --save" and I don't have any problem. I can't see more to do here to fix the problem in the related issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think current solution is perfect
I've just spent a day or so chasing this bug in my code... and this thread as well as Knex Throwing SQLITE Error helped me fix it. I found two solutions that seem to work: either the error message needs to be changed to |
@OlivierCavadenti / @kibertoad: Any indication when this will be released? 🙂 The error message is tripping people up when |
Released in 1.0.5 |
Thank you! |
I have a small crazy question....Why is Knex dependent on @vscode/sqlite3 ? I'm currently working a postgres project....no sqlite on my system...at all. Sooo. Why is Knex dependent on @vscode/sqlite3 ? |
@thefonso Do you mean migration creation or something else? |
@kibertoad Similar to @thefonso comment above, I'm getting the @vscode/sqlite3 error when I'm creating migrations on an exclusively postgres project. Is that expected? |