node.js - Azure 函数中的 Sharp 问题

标签 node.js azure stream resize sharp

您好,我一直在尝试部署我的代码,以在 azure 函数中调整图像流的大小。 它似乎在本地工作得很好,甚至通过 VS code 部署也成功。 但是当我尝试触发该函数时,出现以下异常。

对 Nodejs 和 Azure 来说都比较陌生,有什么建议吗?

2021-06-08T04:51:24.370 [Information] Executing 'Functions.HttpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a)
2021-06-08T04:51:24.444 [Error] Executed 'Functions.HttpTrigger1' (Failed, Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a, Duration=17ms)
Result: Failure
Exception: Worker was unable to load function HttpTrigger1: 'Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.'
Stack: Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.
    at Object.hasVendoredLibvips (C:\home\site\wwwroot\node_modules\sharp\lib\libvips.js:82:13)
    at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\constructor.js:7:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)

最佳答案

根据错误消息,我们需要将Azure功能更新为64位平台。具体操作方法请引用here .

enter image description here

关于node.js - Azure 函数中的 Sharp 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67881736/

相关文章:

Azure Bot 服务每天使用超过 1GB 的数据传输量。为什么?我怎样才能阻止呢?

stream - 事件 vs 流 vs 可观察 vs 异步迭代器

c# - 使用 StreamReader 读取 HttpContent 流直到字符限制

node.js - nodejs请求模块解析body

javascript - pm2 不使用实验模块标志

node.js - 使用 nginx、socket.io 和 nodejs 在树莓派上托管 Angular 应用程序

c# - 具有独立写入和读取位置的流

node.js - Master和Worker集群 : On which core is the Master running?

c# - 我必须显式关闭异步 http 请求的 ResponseStream 吗?

azure - 无法在 Azure Synapse Analytics 中创建表