收藏
回答

云函数安装sharp失败?

本地可以安装,本地调试通过,部署到云端就提示找到不sharp模块,错误信息如下:

Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 8c29cc79-beaa-4f4a-ab8d-d73dbf04bc60, cloud function service error code -504002, error message Error: 

Something went wrong installing the "sharp" module


Cannot find module '../build/Release/sharp-linux-x64.node'

Require stack:

- /var/user/node_modules/sharp/lib/sharp.js

- /var/user/node_modules/sharp/lib/constructor.js

- /var/user/node_modules/sharp/lib/index.js

- /var/user/index.js

- /var/runtime/node16/UserFunction.js

- /var/runtime/node16/Runtime.engine.js

- /var/runtime/node16/bootstrap.js


Possible solutions:

- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"

- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"

- Consult the installation documentation: https://sharp.pixelplumbing.com/install

    at Object.<anonymous> (/var/user/node_modules/sharp/lib/sharp.js:37:9)

    at Module._compile (node:internal/modules/cjs/loader:1101:14)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

    at Module.load (node:internal/modules/cjs/loader:981:32)

    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

    at Module.require (node:internal/modules/cjs/loader:1005:19)

    at require (node:internal/modules/cjs/helpers:102:18)

    at Object.<anonymous> (/var/user/node_modules/sharp/lib/constructor.js:11:1)

    at Module._compile (node:internal/modules/cjs/loader:1101:14)

    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10); at cloud.callFunction api; 

    at new t (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:17:6017)

    at u (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:17:6747)

    at l (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:17:6842)

    at Function.success (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:17:158821)

    at f (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:2:115356)

    at http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:2:116181

    at f (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:26:12526)

    at Function.<anonymous> (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:26:278562)

    at f (http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:2:115356)

    at http://127.0.0.1:62949/appservice/__dev__/WASubContext.js?t=wechat&s=1700092047281&v=2.14.1:2:116181

回答关注问题邀请回答
收藏
登录 后发表内容