node searching in 'node-v11-darwin-x64', fails to find 'node_sqlite3.node' #228

Closed
charlesjdimino opened this Issue Nov 14, 2013 · 9 comments

Projects

None yet

4 participants

@charlesjdimino

STR:

$ cd ~ 
$ mkdir -p tmp && cd tmp
$ npm install node-gyp && cd node_modules
$ git clone git@github.com:mapbox/node-sqlite3.gi && cd node-sqlite3
$ node ../node-gyp/bin/node-gyp.js configure build && cd ../..
$ node 
> var sqlite3 = require('sqlite3');

 Error: Cannot find module './binding/Release/node-v11-darwin-x64/node_sqlite3.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/diminoten/tmp/node_modules/node-sqlite3/lib/sqlite3.js:7:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)     
    at Module.require (module.js:364:17)

I'm not entirely sure I'm doing this the way it's intended, was hoping to get some guidance. I do need to build it myself from source, though, and not pull it from github or npm.

This worked in <=v2.1.15. Only noticed it when I tried to upgrade today.

@springmeyer
Member

For now you need to do npm install. I'd like to restore support for being able to directly call node-gyp and I'm tracking that over at #220

@charlesjdimino

Okay, I'll follow it in that issue. Thanks.

Should I close this issue, then?

@mtrpcic
mtrpcic commented Nov 23, 2013

I am trying to use this module in a node-webkit app. After I install the module using npm install, I need to manually rebuild the package with the custom nw-gyp used for node-webkit, and then I get this exact error. Is there a workaround?

@springmeyer
Member

@mtrpcic the current workaround is to manually copy the binary into the right place.

@jasonfutch

I'm having the same issues.. can you explain "manual copy the binary into the right place" a little more?

@springmeyer
Member

The error message will indicate the exact expected path where the .node file is looked for. Copy the build/Release/node_sqlite3.node file into that path you see in the error (which is slightly different per system)

@springmeyer
Member

This is fixed as part of #245. I tested that the node-webkit standard build approach works in 61ac26a. This will be fixed in the upcoming sqlite@2.2.0 tag.

@ghost
ghost commented Jun 16, 2015

This issue is still occurring for me using OS X Yosemite with Node 0.11.14 and sqlite3 1.0.8

Error: Cannot find module '/Users/matt/Younity/duxpoc/node_modules/dux-server/node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/matt/Younity/duxpoc/node_modules/dux-server/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

It places the binary into:
'node-v0.11.14-darwin-x64'
but it is being looked for in:
'node-v11-darwin-x64'

When copying the binary to the location it is being looked for in, I then get this error:

 dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  Referenced from: /Users/matt/Younity/duxpoc/node_modules/dux-server/node_modules/sqlite3/lib/binding/node-v11-darwin-x64/node_sqlite3.node
  Expected in: dynamic lookup

If somebody could look into this or point me in the right direction to resolving it myself, that would be awesome and much appreciated. We have a lot of code written to use this implementation so it'd be far from ideal to have to switch db implementations. (We had been using node 0.10.36 before which worked fine, but being forced to upgrade to 0.11.14 to use self signed certificates called for a new build against 0.11.14, which has resulted in the broken sqlite3). Thank you.

@springmeyer
Member

@mattfrey - this is a very old issue. Copying is NOT recommended and the error you are seeing is because copying is not going to work. As far as your overall issue:

  • use the latest node-sqlite3 release: v3.0.8
  • use node v0.12.x instead of v0.11.x (which is the unstable and now unmaintained node version)

If you do the two above things and still hit a problem after a fresh install please create a new issue and don't comment on this old issue since its unlikely I will see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment