Packaged Electron App cannot find module sqlite3
<p><b>Background</b></p>

<p>Within an Electron app, sqlite3 doesn't work right after <code>npm install --save</code>. I got it working after doing some web research, by:<br/></p>

<p>(1) downgrading my node version (via <code>n</code>) to match Electron's node version; and </p>

<p>(2) rebuilding sqlite with the right module name/targets with this <code>package.json</code> script:
<code>"rebuild-sqlite3": "cd node_modules/sqlite3 &amp;&amp; npm run prepublish &amp;&amp; node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-darwin-x64 &amp;&amp; node-gyp rebuild --target=1.2.6 --arch=x64 --target_platform=darwin --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/electron-v1.2-darwin-x64"</code></p>

<p>After that, Sqlite3 works in development (i.e. when I run <code>electron .</code> in the project dir).</p>

<p><b>Problem</b></p>

<p>I package the app with <code>electron-packager</code>: <code>"./node_modules/.bin/webpack -p &amp;&amp; ./node_modules/electron-packager/cli.js ./ --out ./bin --platform=darwin --arch=x64 --version=1.2.6 --overwrite --ignore=\"ignore|bin|node_modules\""</code></p>

<p>When I open the app by double-clicking the created (appName).app, the console complains: `Uncaught Error: Cannot find module</p>

<p><b>Question</b></p>

<p>How can I get sqlite3 to be found in the final packaged product? Even "hacks" or workarounds are welcome, as I tried various fixes to no avail.</p>