igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

Including sqlite3 with centos #101

Closed kesav02 closed 8 years ago

kesav02 commented 8 years ago

Hello,

I am evaluating enclose (now that jxcore development is halted) and I am trying to get the very basic test of sqlite3 working on linux, I am using centos 7

I had the same working with jxcore, when I wanted to use my custom sqlite plugin.

However I am unable to get it done, must be doing something wrong :( After I saw it did not work with no modification I tried changing the lib.

I copied node_sqlite3.node plugin to the root folder of my app and changed the node_modules/sqlite3/lib/sqlite3.js code to require the plugin file from disk as below:

try{ var binding = require(path.join(process.cwd(), 'node_sqlite3.node')); } catch(e){ console.log("error in binding"); console.log(e); }

But when I run my code using enclose compiled app (it works well with plain node) I am getting an error - console output:

_error in binding [RangeError: index out of range] undefined:0

TypeError: Cannot set property 'cached' of undefined at Object.console./thebox/home/test/node_modules/sqlite3/lib/sqlite3.js.dev (e:0) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module.load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.console./thebox/home/test/app.js.dev (e:0)

igorklopov commented 8 years ago

index out of range means node runtime executable version does not match native addon file. For example, you have node 6 installed. This means npm install sqlite3 compiles node_sqlite3.node against node 6. On the other hand, you enclose your application against node 4 runtime (you may check this - insert console.log(process.versions) to your app). So compiled addon for v6 does not match enclosed app runtime (v4).

kesav02 commented 8 years ago

Hello,

I started with a clean centos 7, installed node v0.12.14 and then installed enclose using npm I see that process.versions is diffrent between the compiled app and the node JS version.

In node I am at: { http_parser: '2.3', node: '0.12.14', v8: '3.28.71.19', uv: '1.6.1', zlib: '1.2.8', modules: '14', openssl: '1.0.1t' }

In Enclose I am at: { http_parser: '2.5.2', node: '4.4.2', v8: '4.5.103.35', uv: '1.8.0', zlib: '1.2.8', ares: '1.10.1-DEV', modules: '46', openssl: '1.0.2g', enclose: '2.0.2' }

Can I tell enclose to use node 0.12.4 ?

I saw enclose has a -v parameter, but it did not accept 0.12.4

Thanks, Avi

kesav02 commented 8 years ago

Found it :), using enclose -v v0.12.13 made the trick. For some reason the binaries.json I had did not have 0.12.14 but only 0.12.13

I can now continue with my evaluation on enclose :)