%1 is not a valid win32 application from custom node.js addon


I need to create a custom Node.js addon for Electron that wraps a c++ DLL. That was all working fine, until I found I had to use the 32 bit version of the DLL. That didn’t seem like an issue, but as it turns out, I can’t seem to make ANY node addon I build for 32 bit architecture work at all. Every time I run the application, I get, “%1 is not a valid win32 application”. I’ve been building the addon in Windows on Node.js 64 bit with these variables:
set npm_config_target=1.0.1
set npm_config_arch=ia32
set npm_config_runtime=electron
set HOME="C:\Users\myHome.electron-gyp"
set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
and installing 32 bit electron, “npm install --arch=ia32 electron-prebuilt”. I kick off the node-gyp build with, “npm install”.
If I set npm_config_arch=x64 and use 64 bit electron, everything works perfectly.
Any help? Please? I’m totally at a loss here, and this is a project killer if it’s a no go. Could it be that Electron is running under a 64 bit install of Node.js?