1

got my nodejs code where I use the sharp library (0.29.3 version) locally works fine when I deploy to the cloud - got an error I use 64-bit platform, node 14 version, and functions version 3 how I can resolve this issue? rebuilt for many times, changed versions, platforms and no result

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)

1 Answers1

1

Thank you Владислав-Павленко. Glad that you have resolved your Issue, Posting your resolution as an answer so that it will be helpful for other community members who face similar kind of issues.

While deploying the Sharp Module in Azure Functions and if you receive the below error follow the steps mentioned below which will resolve the issue and you can able to deploy smoothly.

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:-

Install the Sharp library with the help of npm install so that the above error will be resolved.

--platform=win32 --arch=x64 sharp
SaiSakethGuduru
  • 2,218
  • 1
  • 5
  • 15