Failed to run my electron app with sqlite3! help please


#1

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=https://atom.io/download/atom-shell --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=https://atom.io/download/atom-shell --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.
\?\Z:\Documents\test\electron\electron-quick-start\ElectronQuickStart-win32-x64\resources\app\node_modules\sqlite3\lib\binding\electron-v1.6-win32-x64\node_sqlite3.node


#2

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=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=YOU8 PATH/node_modules/sqlite3/lib/binding/electron-v1.4-win32-x64 --runtime=electron”


#3

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=https://atom.io/download/atom-shell --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?


#4

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


#5

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


#6

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


#7

I have resolved it.
I use windows build an node-sqlite3 (follow this https://github.com/mapbox/node-sqlite3/issues/761#issuecomment-274280995)
Copy the built node-sqlite3.node file to my project directory in mac, and pack the project
It works.


#8

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.


#9

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