Skip to content
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

Merged
merged 3 commits into from Mar 22, 2022

Conversation

OlivierCavadenti
Copy link
Collaborator

- 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') {
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

@OlivierCavadenti OlivierCavadenti merged commit d0c9027 into knex:master Mar 22, 2022
@OlivierCavadenti OlivierCavadenti deleted the vscode-sqlite3 branch March 22, 2022 22:04
@tompsherman
Copy link

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 npm install @vscode/sqlite3 --save because this fixes the issue but currently the error message reads npm install sqlite3 --save which does not fix the issue no matter how many times you install sqlite3
--OR--
the driver on line 32 knex/lib/dialects/sqlite3/index needs to be changed from return require('@vscode/sqlite3'); to return require('sqlite3');

@daniellockyer
Copy link
Contributor

daniellockyer commented Apr 4, 2022

@OlivierCavadenti / @kibertoad: Any indication when this will be released? 🙂 The error message is tripping people up when @vscode/sqlite3 fails to compile

@kibertoad
Copy link
Collaborator

Released in 1.0.5

@daniellockyer
Copy link
Contributor

Thank you!

@thefonso
Copy link

thefonso commented Apr 6, 2022

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 ?

@kibertoad
Copy link
Collaborator

@thefonso Do you mean migration creation or something else?

@mrondin1
Copy link

mrondin1 commented Apr 12, 2022

@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?

@kibertoad
Copy link
Collaborator

No. See #5106
1.0.6 should help in some cases, #5106 should help with the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants