Getting Error: "%1 is not a valid Win32 application."

888 views
Skip to first unread message

O haya

unread,
Mar 15, 2017, 4:12:10 PM3/15/17
to node-java
Hi,

I have been trying to use node-java with node 6.10 (installed using node-v6.10.0-win-x64.zip).  I installed VS 2012 Express (using VS2012_WDX_ENU.iso) and Python (python-2.7.6.amd64.msi) and when I ran the simple test:


var java = require('java');
var javaLangSystem = java.import('java.lang.System');

javaLangSystem.out.printlnSync('Hello World');

That works.

However, when I try a Node.JS+node-java app that accesses a Java class that I built myself using Eclipse, I am getting the error below:

...module.js:583
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: %1 is not a valid Win32 application.
\\?\e:\apps\...\node_modules\java\build\Release\nodejavabridge_bindings.node
    at Error (native)
    at Object.Module._extensions..node (module.js:583:18)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (e:\apps\...\node_modules\java\lib\nodeJavaBridge.js:21:16)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)


I found some threads that indicated that I may need to use a 32 bit node.js (and rebuild the node-java), but wanted to check if that is the case?  On Windows, is node-java limited to working on only 32 bit Windows?

Thanks,
Jim


O haya

unread,
Mar 16, 2017, 6:32:59 PM3/16/17
to node-java
I am trying another approach to build node-java on Windows.  I setup a Windows 7 32 bit system and installed a 32bit jdk, but I am not able to build the "java".

When I run "npm install java", I am getting:

C:\apps\node-v6.10.0-win-x86\node_modules\java>if not defined npm_config_node_gy
p (node "C:\apps\node-v6.10.0-win-x86\node_modules\npm\bin\node-gyp-bin\\..\..\n
ode_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Project file contains ToolsVersion="14.0". This toolset is unknown or missing.
You may be able to resolve this by installing the appropriate .NET Framework fo
r this toolset. Treating the project as if it had ToolsVersion="4.0".
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets
(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v140') ca
nnot be found. To build using the v140 build tools, either click the Project me
nu or right-click the solution, and then select "Update VC++ Projects...". Inst
all v140 to build using the v140 build tools. [C:\apps\node-v6.10.0-win-x86\nod
e_modules\java\build\nodejavabridge_bindings.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\apps\node-v6.10.0-win-x86\node_mod
ules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:215:12)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "C:\\apps\\node-v6.10.0-win-x86\\node.exe" "C:\\apps\\node-v6.1
0.0-win-x86\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebui
ld"
gyp ERR! cwd C:\apps\node-v6.10.0-win-x86\node_modules\java
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ja...@0.8.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ja...@0.8.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the java package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs java
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls java
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jl\AppData\Roaming\npm-cache\_logs\2017-03-16T22_22_08_148
Z-debug.log


I gather that the "14.0" refers to VS 2015, but since I am on Win7, VS 2012 is the most recent version that I can run on Win7. 

Is that maybe why this error is occurring, like this can only build on very specific version of Windows and only with the "right" combination of Visual Studio?  Does anyone know why this might be happening?  

Thanks,
Jim

O haya

unread,
Mar 17, 2017, 8:12:56 AM3/17/17
to node-java
I gave up on Windows 7 and tried another Win32 machine, a Win8, but the VS 2013 wouldn't install because .NET Framework 4.5.1 wouldn't install.

So I'm pretty much dead in the water with this (node-java on Windows).

The closest I have is the original Node.JS on my actual workstation, but that is giving the original error in this thread about "not a win32" :(.

Jim


On Wednesday, March 15, 2017 at 4:12:10 PM UTC-4, O haya wrote:
Reply all
Reply to author
Forward
0 new messages