possible in npm to force architecture?

1,350 views
Skip to first unread message

sihorton

unread,
Aug 28, 2012, 8:23:11 AM8/28/12
to nod...@googlegroups.com
I am on 64bit windows and am able to compile iconv. However I want to distribute the application to run on 32 bit windows. I am able to run the "Windows SDK 7.1 Command Prompt" and set the architecture to x86. However when I then do:

npm install iconv

I get the followng:

>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Windows7.1SDK\Microsoft.Cpp.x64.Windows7.1SDK.targets(20,5): error : You are attempting to build an AMD64 application from an x86 environment. If using the Windows 7.1 SDK, type setenv /x64 [C:\Program Files (x86)\nodejs\node_modules\iconv\build\iconv.vcxproj]
gyp ERR! rebuild error Error: `msbuild` failed with exit code: 1
gyp ERR! rebuild error     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:215:23)


Looking through the docs it appears that npm is trying to compile the 64bit version of iconv since that is what process.arch returns as the architecture. How do I force npm to build the 32bit version instead?

/Simon

Bradley Meck

unread,
Aug 28, 2012, 8:43:00 AM8/28/12
to nod...@googlegroups.com
try setting the `npm_config_arch` environmental variable to your desired architecture when spawning `npm`.

Related Code:

Simon Horton

unread,
Aug 28, 2012, 8:51:16 AM8/28/12
to nod...@googlegroups.com
Thanks a lot that worked for me :-)
Reply all
Reply to author
Forward
0 new messages