I'm currently developing on a Windows 8 64-bit computer. I'm actually using node-xmpp to create a chat client, and running npm install node-xmpp
works. I created a file called index.js
that simply has:
var xmpp = require('node-xmpp');
console.log(xmpp);
Then I run node index.js
and it dumps the object as expected. However; the plan is to deliver this as desktop software utilizing the node-webkit library. That library uses the Chromium Embedded Framework (CEF), which is limited to using node on a 32-bit architecture. So, I downloaded the 32-bit version of node, put it in my path, and renamed it to node32.exe. When I run node32 index.js
, I get the following error:
module.js:485
process.dlopen(filename, module.exports);
^
Error: %1 is not a valid Win32 application.
C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\Release\node_expat.node
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\lib\nod
e-expat.js:4:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I figured this was probably because my npm installation picked up the x64 architecture and compiled accordingly. So, I nuked the node_modules
directory and started from scratch. This time, I made copies of npm
and npm.cmd
as npm32
and npm32.cmd
, where I substituted node32.exe for node.exe. When I attempt to install this way, I get the following:
C:\Users\Corey\Documents\workspace\tmp>npm32 install node-xmpp
npm http GET https://registry.npmjs.org/node-xmpp
npm http 304 https://registry.npmjs.org/node-xmpp
npm http GET https://registry.npmjs.org/node-expat
npm http GET https://registry.npmjs.org/ltx
npm http 304 https://registry.npmjs.org/ltx
npm http 304 https://registry.npmjs.org/node-expat
npm http GET https://registry.npmjs.org/sax
npm http 304 https://registry.npmjs.org/sax
[email protected] install C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat
node-gyp rebuild
C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat>node "C:\Program Files\nodejs\node
_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
xmltok.c
xmlrole.c
xmlparse.c
......\deps\libexpat\lib\xmlparse.c(1844): warning C4244: 'return' : conversion from '__int64' to 'XML_Index', possible loss of data [C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
expat.vcxproj -> C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\Release
lib\libexpat.lib
node-expat.cc
..\node-expat.cc(165): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [C:\Users\C
orey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\node_expat.vcxproj]
..\node-expat.cc(409): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) [C:\Users\C
orey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\node_expat.vcxproj]
..\node-expat.cc(422): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) [C:\Users\C
orey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\node_expat.vcxproj]
C:\Users\Corey.node-gyp\0.8.16\deps\v8\include\v8.h(183): warning C4506: no definition for inline function 'v8::Persis
tent v8::Persistent::New(v8::Handle)' [C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modu
les\node-expat\build\node_expat.vcxproj]
with
[
T=v8::Object
]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(1138,5): warning MSB8012: TargetExt(.
dll) does not match the Linker's OutputFile property value (.node). This may cause your project to build incorrectly. T
o correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specifi
ed in %(Link.OutputFile). [C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\
node_expat.vcxproj]
Creating library C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\Relea
se\node_expat.lib and object C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\bu
ild\Release\node_expat.exp
Generating code
Finished generating code
node_expat.vcxproj -> C:\Users\Corey\Documents\workspace\tmp\node_modules\node-xmpp\node_modules\node-expat\build\Rel
ease\node_expat.node
[email protected] node_modules\node-xmpp
├── [email protected] ([email protected])
└── [email protected]
So, it builds with errors, but it builds. When I attempt to run node index.js
, it succeeds. When I run node32 index.js
, it throws the same error. So, clearly I'm missing something in building the node-expat module. Is the architecture something handled in node-expat, or is this more of a node-gyp issue?
Any thoughts on the matter are appreciated.