Invalid Win32 application while using iisnode, nodejs and node-soap library - node.js

I'm having some issues setting up a Node.js/Node-soap service running on IIS 7, Windows Server 2008, with iisnode and node.js 0.10.20. This same setup, with the same code, is running on another server inhouse and works perfectly.
The problem is that the setup process wasn't documented, and the person that put it all up is not available to migrate it to the new server. And I have no prior knowledge in Node nor IISnode.
This is the error message that gets printed:
iisnode encountered an error when processing the request.
HRESULT: 0x2 HTTP status: 500 HTTP reason: Internal Server Error You
are receiving this HTTP 200 response because
system.webServer/iisnode/#devErrorsEnabled configuration setting is
'true'.
In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.
The last 64k of the output generated by the node.exe process to stderr
is shown below:
Application has thrown an uncaught exception and is terminated: Error:
%1 is not a valid Win32 application.
\node_modules\soap\node_modules\node-expat\build\Release\node_expat.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (<Path to application>\node_modules\soap\node_modules\node-expat\lib\node-expat.js:4:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I've added the following to my Node.js file:
Now what I have found online, tried but hasn't worked, is as follows:
From this Stack Overflow question I tried two things:
Added this part to my Node.js file.
<iisnode watchedFiles="*.js;node_modules\*;routes\*.js;views\*.jade" nodeProcessCommandLine="\program files\nodejs\node.exe"/>
Created a symbolic link:
mklink /D "C:\Program Files (x86)\nodejs" "C:\Program Files\nodejs"
Will update if I try something else.
All help would be appreciated.
UPDATE 1:
I've made sure that the Enable32-Bit Applications = False. is set in IIS, and repaired the VS 2010 x64 redist binary

This error message suggests the bitness of \node_modules\soap\node_modules\node-expat\build\Release\node_expat.node does not match the bitness of the IIS worker process (w3wp.exe). Since you appear to be running IIS with 64 bit worker processes (Enable 32-bit Applications == False), it may indicate that node_expat.node is a 32-bit binary?

Related

Invalid ELF Header on Production Server

Does anyone know why this error is occurring only on the production server and not when I run it locally?
internal/modules/cjs/loader.js:815
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:815:18)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
The live server uses Plesk. I would appreciate any suggestions.
Also, please note that * * SITE_NAME * * is the domain name of the site, I didn't want to include it in this post for obvious reasons.
Picture of Error
I found the answer because I installed bcrypt on a Windows machine, but the production server is running Linux meant that it didn’t have the correct files to work with.
I fixed it by installing bcrypt on a Linux machine and then uploading it to the hosting server.
Do you use Docker? If yes, this question on Stack Overflow may already give you the answer.
TLDR: The .dockerignore file should include your node_modules folder.

Azure NodeJS 'Error: %1 is not a valid Win32 application.'

I am trying to make a NodeJS App service using Azure. However, it appears the node module -nodehun- I am trying to use is interfering with the compilation process.
See error:
\\?\D:\home\site\wwwroot\node_modules\nodehun\build\Release\nodehun.node
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\home\site\wwwroot\server.js:6:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Wed Sep 20 2017 16:18:27 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
Error: %1 is not a valid Win32 application.
After a bit of searching, this can be caused by a mismatch between 32/64bit architecture of node.exe and the built module. Although, I'm not sure how to fix this problem within Azure.
According to the error message you got, it seems that nodehun requires 64bit node.js runtime. By default, Azure App Service does not have 64bit node.exe installed. The workaround for what you want to do would be place 64 bit node.exe in d:\home\site\wwwroot\runtime and then create a iisnode.yml with the following content:
nodeProcessCommandLine: "D:\home\site\wwwroot\runtime\node.exe"
After that done, don't forget to restart your App Service. More details, please refer to bcrypt not a valid win 32 application on azure app service.
Thanks to Aaron Chen for pointing me in the right direction.
In the Azure web app, there is a Web.config file. Within this file there is an iisnode section, which I added the nodeProcessCommandLine to, e.g:
<iisnode watchedFiles="web.config;*.js" nodeProcessCommandLine="D:\home\site\wwwroot\runtime\node.exe"/>
This fixes the above error and runs node as 64bit, provided a 64bit version of node is supplied.

azure wep app gallery installation of ghost http 500 error

I have a new Ghost app install from the app gallery on azure, the install finished and I have gone to the URL for the web app and I get this error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.
I have tried going to the ?admin? section with the /ghost/ and still get HTTP 500
I have seen another post which suggests /ghost/setup/ and still get HTTP 500
I have seen another post which suggests /ghost/signup/ and still get HTTP 500
I've tried deleting the Web App and recreating but still get the same errors. There doesn't seem to be any documentation anywhere on azure either
Found this error
[31m
ERROR:[39m [31mCannot find module 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\node-v46-win32-ia32\node_sqlite3.node'[39m
Error: Cannot find module 'D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\node-v46-win32-ia32\node_sqlite3.node'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (D:\home\site\wwwroot\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
The Node Installation seems to be wrong...
D:\home\site\wwwroot\node_modules\sqlite3\lib\binding\
the Azure Installation has installed 2 node folders:
node-v11-win32-ia32
node-v11-win32-x64
Go to Kudu. E.g. https://yoursite.scm.azurewebsites.net/
Navigate to site\wwwroot
Run npm install --production
More info here...

Use edge js on openshift

I'm trying to run C# on my OpenShift cartridge with Edge.js. It runs really good on my Windows PC and I would like to have it running on the cloud.
I'm guessing it runs on a Linux environment but I'm not shure.
At first I tried to make it work with my MSSQL DB and than move on to the C# assembly.
Nevertheless I'm doing the same steps as how I've got it to work on my Windows machine but I'm getting thesame errors over and over again.
I've added edge and edge-sql to my npm and my package.json.
Then I've make a simple count to my MSSQL DB.
When I'm running it locally it works great. Than I push it to OpenShift and I tail the application, because the front-end gives me an Error 503, and the next thing I know the following error makes me keepings my hands in my hair.
Error: The edge native module is not available at /var/lib/openshift/54d26260fcf
933d05e00021a/app-root/runtime/repo/node_modules/edge/build/Release/edge.node. Y
ou can use EDGE_NATIVE environment variable to provide alternate location of edg
e.node. If you need to build edge.node, follow build instructions for your platf
orm at https://github.com/tjanczuk/edge
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/node_modules/edge/lib/edge.js:33:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/server.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
/var/lib/openshift/54d26260fcf933d05e00021a/app-root/runtime/repo/node_modules/e
dge/lib/edge.js:33
throw new Error('The edge native module is not available at ' + builtEdge
Could somebody help me to fix this error or maybe explain to me why it could / wont work?
If edge requires a native windows environment to run C#, then it will not work on OpenShift, which runs on Red Hat Linux.

How to use node-oracle with iisnode?

I'm having trouble trying to run a Node.js server with node-oracle via iisnode. The iisnode examples all work, and running the server [on a different port] in a Command Window works perfectly. The server setup is based upon "The Node Beginner Book" example (i.e. index.njs -> server.njs -> router.njs -> requesthandlers.njs). I renamed all of my node files as *.njs and currently have my web.config set up for iisnode to handle all files of that extension, with a rewrite rule to forward the incoming requests to index.njs. The problem occurs when node-oracle -- utilized within requesthandlers.njs -- attempts to call oracle_bindings.node:
Application has thrown an uncaught exception and is terminated:
Error: The specified module could not be found.
c:\Program Files\iisnode\www\Reports\node_modules\oracle\build\Release\oracle_bindings.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (c:\Program Files\iisnode\www\Reports\node_modules\oracle\lib\oracle.njs:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I've given read/write/execute permissions to the IIS_IUSRS group on every folder imaginable within the .\iisnode\www\Reports\node_modules\oracle path. I've also attempted the solution in Node cannot find modules in IIS, can find from prompt to no avail. While I could probably just set the server up as a service, I'd prefer to have it through IIS so that I don't have to battle with CORS while supporting IE9. Any help is greatly appreciated, thanks!

Resources