Failed to run my electron app with sqlite3! help please


I have rebuild the sqlite3 in my project with this script:

cd node_modules/sqlite3 && npm install nan && node-gyp configure --module_name=node_sqlite3 --module_path=…/lib/binding/electron-v1.6-darwin-x64 && node-gyp rebuild --target=1.6.2 --arch=x64 --target_platform=darwin --dist-url= --module_name=node_sqlite3 --module_path=…/lib/binding/electron-v1.6-darwin-x64

and then I built it for mac, it works well.

But when I rebuild the sqlite for windows:

cd node_modules/sqlite3 && sudo npm install nan && sudo npm run prepublish && sudo node-gyp configure --module_name=node_sqlite3 --module_path=…/lib/binding/electron-v1.6-win32-x64 && node-gyp rebuild --target=1.6.2 --arch=x64 --target_platform=win32 --dist-url= --module_name=node_sqlite3 --module_path=…/lib/binding/electron-v1.6-win32-x64

then I built it for windows8 on my mac, and run it in the windows8, its blocked!

Uncaught Error: %1 is not a valid Win32 application.


try this one (it’s works for me) :slight_smile:
Change “YOUR_PATH” by your workspace

“rebuild-sqlite3-win”: “cd node_modules/sqlite3 && npm run prepublish && echo ‘chemin’ pwd && node-gyp configure --module_name=node_sqlite3 --module_path=YOUR8PATH/node_modules/sqlite3/lib/binding/electron-v1.4-win32-x64 && node-gyp node-gyp rebuild --target=0.36.0 --arch=x64 --target_platform=win32 --dist-url= --module_name=node_sqlite3 --module_path=YOU8 PATH/node_modules/sqlite3/lib/binding/electron-v1.4-win32-x64 --runtime=electron”


Thanks Jeje!
My sqlite3 version is 3.1.11, there is no republish script in the package file.
I run the script :
cd node_modules/sqlite3 && node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.7-win32-x64 && node-gyp rebuild --target=1.7.6 --arch=x64 --target_platform=win32 --dist-url= --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.7-win32-x64 --runtime=electron

got the same error:
Uncaught Error: %1 is not a valid Win32 application.

Is anything wrong here?


When you say, you run the script, did you run :npm run rebuild-sqlite3-win ?


Yes, the script of the cmd is what I say before.


I just finished my windows8 installing, when I run the script, I build failed, got this error:


I have resolved it.
I use windows build an node-sqlite3 (follow this
Copy the built node-sqlite3.node file to my project directory in mac, and pack the project
It works.


Hi velievil, I wasted all day trying to fix this issue you ran into. I followed the instructions from the mapbox issue post, but am still stuck at “not a valid Win32 application” error.

What exactly did you change to make it work? I reviewed the steps that kqadem described in his post in the mapbox site, but don’t really see anything significantly different from what you described above.

Thanks in advance.


Hi Puruzio

I follow the post and build a node-sqlite3.node file in my windows 8, and copy it into “./node_modules/sqlite3/lib/binding/electron-v1.7-win32-x64”, then I pack it success