node-sqlite3 icon indicating copy to clipboard operation
node-sqlite3 copied to clipboard

Electron 1.2.x SQLite3 not working on windows (DLL related issue)

Open CheckMater opened this issue 10 years ago • 4 comments

Hi, I already spent 3 days trying to fix this problem, the SQLIte3 module works fine in Linux and Darwin, but in windows x64 it is launching the following error:

A dynamic link library (DLL) initialization routine failed. node_modules\sqlite3\lib\binding\electron-v1.2-win32-x64\node_sqlite3.node

I tried rebuilding the module targeting electron 1.2.7 with this commands:

npm run prepublish
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-win32-x64
node-gyp rebuild --target=1.2.7 --arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-win32-x64

But it fails throwing a lot of erros and warnings about deprecated stuff, if I change the target to electron v. 0.37.0 then it compiles correctly but I get the same DLL error and I have no idea why is it happening.

Had anyone any luck when trying to use the SQLIte module in windows with the latests electron versions? All I have found is just rebuild instructions using always the 0.x.x versions.

I'm trying to run this on:

  • Windows 10 x64
  • Node 6.3.0
  • NPM 3.10.3
  • Electron 1.2.7

Thanks in advance.

CheckMater avatar Jul 17 '16 03:07 CheckMater

Hi, I faced the rebuilding issue and fixed in my environment.

  • Windows 7 x64
  • node 4.4.1
  • npm 2.1.4.20
  • Electron 1.3.1

A dynamic link library (DLL) initialization routine failed. node_modules\sqlite3\lib\binding\electron-v1.2-win32-x64\node_sqlite3.node

I assume the path above is a part of the DLL error message. Is the path actually exists on your file system? If not, it obviously fails.

It will be helpful that you provide the error messages.

I hope this helps.

noobar avatar Jul 28 '16 06:07 noobar

Can't use Node 6.x @CheckMater - I found this out the extremely hard way. This whole build process really needs fixing on Windows. Some prebuilt binaries here would go a LONG way for this project.

The only successful combination that's worked for me:

  • node 4.4.x
  • npm 2.x.y
  • python 2.7
  • visual studio 2013 express (didn't work for me in vs2015)
  • set environment variable GYP_MSYS_VERSION=2013
  • launch the Developer Command Prompt for VS2013 shortcut as Administrator
npm run prepublish
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.3-win32-x64
node-gyp rebuild --target=1.3.0 --target_arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.3-win32-x64 --runtime=electron`

erikyuzwa avatar Aug 04 '16 17:08 erikyuzwa

Is doing this:

npm run prepublish node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.3-win32-x64 node-gyp rebuild --target=1.3.0 --target_arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.3-win32-x64 --runtime=electron`

Is the same as using electron-rebuild .\node_modules.bin\electron-rebuild.cmd ?

@erikyuzwa Did you manage to get SQLite to work after rebuilding ?

curtwagner1984 avatar Oct 02 '16 15:10 curtwagner1984

Is the same as using electron-rebuild .\node_modules.bin\electron-rebuild.cmd

@CheckMater I don't know. I had no idea that existed. I'd say go for it and see what happens.

Mine rebuilds SQLite3 and works for me every time now, so I'm leaving it. :+1:

erikyuzwa avatar Oct 02 '16 16:10 erikyuzwa