//引入这个就会报错,本地已经安装依赖了,本地运行正常,上传到云报错
const sharp = require("sharp");
package.json如下图
报错内容:
2022-08-12T17:33:42.714Z
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/service/client/face/kh/face.js
- /var/user/config.js
- /var/user/__index.js
- /var/user/index.js
- /var/runtime/node12/UserFunction.js
- /var/runtime/node12/Runtime.engine.js
- /var/runtime/node12/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
2022-08-12T17:33:42.715Z 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/service/client/face/kh/face.js
- /var/user/config.js
- /var/user/__index.js
- /var/user/index.js
- /var/runtime/node12/UserFunction.js
- /var/runtime/node12/Runtime.engine.js
- /var/runtime/node12/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:34:9)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/var/user/node_modules/sharp/lib/constructor.js:8:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
1***@qq.com
不是这个原因,
2024-05-05 15:57