bcrypt在azure应用程序服务上不是有效的win 32应用程序 [英] bcrypt not a valid win 32 application on azure app service

查看:176
本文介绍了bcrypt在azure应用程序服务上不是有效的win 32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了使用Sharp库的Node库进行一些图像处理,我必须将Azure App Service上的node可执行文件升级到64位.我是通过手动下载可执行文件,然后在IISNode.yml中设置其路径来实现的.

In order to do some image processing using the Node library, Sharp, I had to upgrade my node executable on Azure App Service to 64-bits. I did this by downloading the executable manually and then setting its path in IISNode.yml.

不幸的是,当我启动该应用程序时,它引发了以下错误:

Unfortunately, when I start the app, it throws the following error:

应用程序引发了未捕获的异常并被终止: 错误:%1不是有效的Win32应用程序.

Application has thrown an uncaught exception and is terminated: Error: %1 is not a valid Win32 application.

\\?\D:\home\site\wwwroot\node_modules\bcrypt\build\Release\bcrypt_lib.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 Function.cls_wrapMethod [as _load] (D:\home\site\wwwroot\node_modules\newrelic\lib\shimmer.js:256:38)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at bindings (D:\home\site\wwwroot\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\bcrypt\bcrypt.js:3:35)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Function.cls_wrapMethod [as _load] (D:\home\site\wwwroot\node_modules\newrelic\lib\shimmer.js:256:38)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\bookshelf-bcrypt\index.js:5:14)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

我正在使用Appveyor CI系统构建和部署应用程序.这是我的appveyor.yml文件的相关部分:

I'm building and deploying the application using the Appveyor CI system. Here's my the relevant portion of my appveyor.yml file:

install:
  - ps: Install-Product node $env:nodejs_version x64
  - SET CL=-DDELAYIMP_INSECURE_WRITABLE_HOOKS
  - npm i --loglevel=warn
  - npm prune --production
  - 7z a api.zip * -x!test -x!db -x!.git -xr!.* -x!README.md -x!nodemon.json -x!appveyor.yml | FIND /V "ing  "

您会看到我正在使用64位版本的Node进行构建.

You'll see that I'm building using a 64-bit version of Node.

在我的Azure应用服务上,我将平台设置为64位.

On my Azure app service, I have the platform set to 64-bit.

我尝试过的事情:

  • 在Azure上将平台设置为32位
  • 在App Service上吹走node_modules/

提前谢谢!

推荐答案

Azure Web Apps上的默认node.js执行应用程序全部为32位.因此,这引发了您的问题.我们可以使用定制的node.js运行时来满足您的需求.请尝试以下步骤:

The default node.js executation applications on Azure Web Apps are all in 32bit. So it raises your issue. We can use the custom node.js runtime to achieve your requirement. Please try the following steps:

1,在您的应用程序中放入一个64位的node.exe执行应用程序,例如 在runtime文件夹中.

1, Put a 64bit node.exe executation application in your application, e.g. in a runtime folder.

2,修改iisnode.yml,设置:

nodeProcessCommandLine: "D:\home\site\wwwroot\runtime\node.exe"

3,将整个应用程序部署到Azure Web Apps.

3, Deploy your entire application to Azure Web Apps.

此外,您可以使用以下代码来验证node.js二进制文件是否为x64.

Additionally, you can use the following code to verify that whether the node.js binary is x64 or not.

var http = require("http");

http.createServer(function (request, response) {
    response.writeHead(200, { "Content-Type": "text/plain" });
    response.write(require('os').arch());
    response.end();

}).listen(process.env.PORT);

请告诉我这是否无效.

这篇关于bcrypt在azure应用程序服务上不是有效的win 32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆