WebReflection / dblite

sqlite for node.js without gyp problems
MIT License
209 stars 34 forks source link

how make it run on Windows #50

Closed laooduu closed 7 years ago

laooduu commented 7 years ago

I work on windows 7, and install the sqlite3 in the folder C:\albert\sqlite, both sqlite3.dll and sqlite3.exe exist in this folder. and I installed dblite ( npm install dblite ) in my Visual Studio Code. and create a database file named 'abc.db' and a source code file app.js, it contains the following source codes. var dblite = require('dblite'); db = dblite('./abc.db');

however it throw the following error: Exception has occurred: Error Error: kill EINVAL at exports._errnoException (util.js:1018:11) at ChildProcess.kill (internal/child_process.js:397:13) at setUpAndGo (c:\albert\NetCode\NodejsWorkspace\dblitetest\node_modules\dblite\build\dblite.node.js:162:19) at Socket.onerror (c:\albert\NetCode\NodejsWorkspace\dblitetest\node_modules\dblite\build\dblite.node.js:135:11) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at onwriteError (_stream_writable.js:343:10) at onwrite (_stream_writable.js:361:5) at __dirname.WritableState.stream.onwrite (_stream_writable.js:90:5) at fireErrorCallbacks (net.js:467:13)

would you please take a look at this issue or give me some ideas to make it run on Windows

WebReflection commented 7 years ago

try both this var dblite = require('dblite').withSQLite('3.8.6+'); and the following too dblite.bin = 'absolute-path-to-your-sqlite3-file';

not necessarily together

laooduu commented 7 years ago

many thanks, the followings works

var dblite = require('dblite').withSQLite('3.8.6+');

what is the reason?

WebReflection commented 7 years ago

It seems that sqlite3 version 3.8.8+ introduced a new line \n on Windows machines too so the whole initialization is now performed asynchronously and through features detection.

https://github.com/WebReflection/dblite#updates

barbalex commented 6 years ago

Same problem here. Above solutions did not work.

And now I am utterly confused: is '/folder/to/file.sqlite' the path to the sqlite .db file or is it the path to a sqlite exe or .dll file?

And if it were not the path to the .db file, how would I tell dblite what .db file to use?

I believe it would help a lot if you explained in the readme what exactly are:

WebReflection commented 6 years ago

files with .sqlite extensions are usually sqlite databases

the file set as prog.bin = '...' is the binary file / executable file

this project works on windows too

barbalex commented 6 years ago

Thanks for helping, I may have gotten it right. Can't test it yet though because of problems with my create-react-app using electron setup :-(