0

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.

BoyUnderTheMoon
  • 741
  • 1
  • 11
  • 27

2 Answers2

1

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.

Aaron Chen
  • 9,835
  • 1
  • 16
  • 28
0

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.

BoyUnderTheMoon
  • 741
  • 1
  • 11
  • 27