gpt4 book ai didi

node.js - azure 函数 javascript 锐利模块

转载 作者:行者123 更新时间:2023-12-03 02:18:43 25 4
gpt4 key购买 nike

得到了我使用sharp库的nodejs代码(0.29.3版本)本地工作正常当我部署到云时 - 出现错误我使用64位平台,node 14版本,functions版本3我该如何解决这个问题?重建了很多次,换了版本、平台都没有结果

2021-11-17T14:59:00.134 [Error] Executed 'Functions.maplayers' (Failed, Id=03500766-e795-47e0-ab69-68dc0d22d31b, Duration=31ms)Result: FailureException: Error:Something went wrong installing the "sharp" moduleCannot find module '../build/Release/sharp-win32-x64.node'Require stack:- D:\home\site\wwwroot\node_modules\sharp\lib\sharp.js- D:\home\site\wwwroot\node_modules\sharp\lib\constructor.js- D:\home\site\wwwroot\node_modules\sharp\lib\index.js- D:\home\site\wwwroot\common\image.js- D:\home\site\wwwroot\maplayers\geotiff\index.js- D:\home\site\wwwroot\maplayers\index.js- D:\Program Files (x86)\SiteExtensions\Functions\3.3.1\workers\node\worker-bundle.js- D:\Program Files (x86)\SiteExtensions\Functions\3.3.1\workers\node\dist\src\nodejsWorker.jsPossible solutions:- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"- Install for the current runtime: "npm install --platform=win32 --arch=x64 sharp"- Consult the installation documentation: https://sharp.pixelplumbing.com/installStack: Error:Something went wrong installing the "sharp" moduleCannot find module '../build/Release/sharp-win32-x64.node'Require stack:- D:\home\site\wwwroot\node_modules\sharp\lib\sharp.js- D:\home\site\wwwroot\node_modules\sharp\lib\constructor.js- D:\home\site\wwwroot\node_modules\sharp\lib\index.js- D:\home\site\wwwroot\common\image.js- D:\home\site\wwwroot\maplayers\geotiff\index.js- D:\home\site\wwwroot\maplayers\index.js- D:\Program Files (x86)\SiteExtensions\Functions\3.3.1\workers\node\worker-bundle.js- D:\Program Files (x86)\SiteExtensions\Functions\3.3.1\workers\node\dist\src\nodejsWorker.jsPossible solutions:- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"- Install for the current runtime: "npm install --platform=win32 --arch=x64 sharp"- Consult the installation documentation: https://sharp.pixelplumbing.com/installat Object. (D:\home\site\wwwroot\node_modules\sharp\lib\sharp.js:30:9)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. (D:\home\site\wwwroot\node_modules\sharp\lib\constructor.js:8:1)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. (D:\home\site\wwwroot\node_modules\sharp\lib\index.js:3:15)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. (D:\home\site\wwwroot\common\image.js:1:15)

最佳答案

谢谢Владислав-Павленко 。很高兴您已经解决了您的问题,将您的解决方案作为答案发布,以便对面临类似问题的其他社区成员有所帮助。

在 Azure Functions 中部署 Sharp 模块时,如果收到以下错误,请按照下面提到的步骤操作,这将解决问题,并且您可以顺利部署。

2021-11-17T14:59:00.134 [Error] Executed 'Functions.maplayers' (Failed, Id=03500766-e795-47e0-ab69-68dc0d22d31b, Duration=31ms)Result: FailureException: Error:Something went wrong installing the "sharp" moduleCannot find module '../build/Release/sharp-win32-x64.node'Require stack:-

借助npm install安装Sharp库,即可解决上述错误。

--platform=win32 --arch=x64 sharp

关于node.js - azure 函数 javascript 锐利模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70006845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com