Closed thomasthebro1 closed 3 years ago
Temporary fix is to downgrade sqlite:
yarn install sqlite@^3.0.0
Temporary fix is to downgrade sqlite:
yarn install sqlite@^3.0.0
Already done this for now, thanks for the advice though!
The following works for me with sqlite@^4.0.5
client.setProvider(
sqlite.open( { filename: path.join(__dirname, "settings.sqlite3") } ).then( db => new Commando.SQLiteProvider(db) )
).catch(console.error);
Seems like newer SQLite versions no longer accepts plain string paths and now requires the usage of a config object even if only thing you'd define is the filename/path.
Ok thats great. I will give it a go later.
Seems like newer SQLite versions no longer accepts plain string paths and now requires the usage of a config object even if only thing you'd define is the filename/path.
Yes, it does appear so. In their change log for version 4, there is a breaking change:
Opening a new database has changed. See
README.md
for example.
In the README.md
, the parameters passed to .open()
are an object as opposed to the reproducible code provided.
When you update to a new major version, it's advised to read through their change log before updating as there may be breaking changes.
can i plz have help i keep getting Error: sqlite: filename is not defined
Commando only lists sqlite v3 as a dependency, so if you are installing v4, that's technically incorrect. It does work with v4, you just need to pass the correct parameters to sqlite due to that breaking change.
If the above isn't working for you (it may not be working for me due to my version of Linux) try the solution below using better-sqlite
Firstly install better-sqlite3 using npm npm i better-sqlite3
(this may take one or two minutes to install)
Then simply copy and paste this code into your project (index.js):
const database = require('better-sqlite3')
const db = new database('settings.db')
client.setProvider(
new commando.SyncSQLiteProvider(db)
)
In the documentation, if you go to SyncSqliteProvider it doesn't say it specifically but it is for better-sqlite3 as that executes synchronously or something like that. i should request that the documentation is a bit clearer as I was getting pretty confused.
Hi there, I am using Node Version
13.12.0
. When trying to setup a SQLite Provider usingclient.setProvider()
I get the following error:Error: sqlite: filename is not defined
I believe this might be because of an update which sqlite has done to their module. Any help will be greatly appreciated as this is currently greatly affecting my bot settings.
My code is: