I'm developing an application that I plan to distribute using node-webkit, which only has 32-bit binaries on Windows. My OS is Windows 7 Ultimate 64-bit, so npm is building 64-bit binaries of protobuf for node, which is a prerequisite of one of the modules I am using.
I have tried:
- npm install protobuf --arch=ia32
- npm install protobuf --target_arch=ia32
- npm set npm_config_arch ia32
- Installing the 32-bit version of node and npm and using it to install protobuf
And a few other things that I can't remember at the moment.
How can I get npm to build 32-bit binaries? Would I have to build it on a 32-bit machine?
You should be able to clone the repo into node_modules yourself and compile it manually using
node-gyp clean configure build --verbose --arch=ia32
inside the directory where you cloned the repo.
Add a file in your project root called .npmrc
Windows explorer doesn't allow creation of a file name starting with a dot, but this can be done on windows command line like this:
type NUL > .npmrc
Then add the following line to the file:
npm_config_arch=ia32
You may also want to put this line in there to force VS build version, since some packages want to use non-installed versions. Replace 2013 with your version of Visual Studio if different (2012, etc):
msvs_version=2013