WebReflection / dblite

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

Uncaught invalid executable error with nwjs 0.23.0 #49

Closed Blatman closed 7 years ago

Blatman commented 7 years ago

OSX El Capitan 10.11.6

Getting error from /Users/blatman/Desktop/invalidexec/node_modules/dblite/build/dblite.node.js:879 Uncaught invalid executable: /Users/blatman/Desktop/invalidexec/node_modules/sqlite3/sqlite3

dblite.node.js 876 value = path.resolve(value); 877 // verify it exists 878 if (!require(IS_NODE_06 ? 'path' : 'fs').existsSync(value)) { 879 throw 'invalid executable: ' + value; 880 }

sqlite3 is latest 3.1.8 npm install Both versions of nwjs 0.23.0 get this error and don't work.

However if I replace the sqlite3 module with an earlier install which was still 3.1.8 I get the scenario where the nwjs using node 7 and earlier will work fine and give no errors. The nwjs version using node 8 will crash.

Initially thought node v8 was a suspect but then not sure why dblite is not liking sqlite3 all of a sudden. Has node 8 done something with fs.existsSync maybe?

nwjs 0.23.0 - node v 7.10.0 http://dl.nwjs.io/live-build/05-26-2017/nw23-b56aac2-03b9af7-4a0cadc-f041292/v0.23.0/nwjs-sdk-v0.23.0-osx-x64.zip

nwjs 0.23.0 - node v 8.0.0pre http://dl.nwjs.io/live-build/05-31-2017/nw23-b56aac2-9b4425c-10a09e1-c429d34/v0.23.0/nwjs-sdk-v0.23.0-osx-x64.zip

WebReflection commented 7 years ago

why are you using sqlite3 as node_module ?

WebReflection commented 7 years ago

let me rephrase ... dblite was born for every platform where sqlite node bindings do not work.

It's not meant to work with sqlite3 npm node module and it never will.

The executable it expects is the real sqlite3 executable, not a nodejs binding.

To know if you have sqlite3 installed, type which sqlite3 in the terminal.

If it doesn't show a full path to a real sqlite3 binary, you need to install it via homebrew or whatever other option you have.

Blatman commented 7 years ago

Thanks for the response. I was using the sqlite3 node module as a convenient executable rather than relying on one being installed on the machine but since that is not supported I have commented out the node module path in the test project and it uses my machine installation (usr/bin/sqlite3). The nwjs 0.23.0 with node 8 still crashes but the database appears to work so I guess the invalid executable errors were down to the node module usage and the crashing is maybe more toward nwjs/chromium/node. I will present the bug to the nwjs folk. The attached log shot shows the FATAL and appears to indicate that the database has functioned. Cheers. dblite

WebReflection commented 7 years ago

rather than relying on one being installed on the machine

sqlite3 is most likely already installed everywhere but the point is that dblite uses the real executable via a spawned bridge.

dblite was born for MIPS and ARM boards where bindings were not pre-built or not compatible.

You can use it with Mac or Linux (or Windows) without issues too but it's not meant, like I've said, to work with bindings (actually it's pointless to use dblite if your machine or your project runs only on bindings compatible targets)

If you find any issue related to dblite, feel free to reopen this bug and please provide a very basic step to reproduce it.

Until that, I'll close it as invalid.

Best Regards

Blatman commented 7 years ago

Just a tidy up - thanks for clarifying the situation regarding the sqlite exec. The problem ended up being a bug in the nwjs 0.23.0 build using node 8 and has been fixed - bug report #5943 Cheers.