首页 > 解决方案 > 在 AWS lambda 中使用 Sharp 模块时出错

问题描述

我在 AWS 上部署了一个 lambda,它使用 Sharp 模块来调整图像大小。

尽管使用 linux 部署,还是会发生以下错误:

“安装sharp模块出了点问题,

Module parse failed: Unexpected character 'u007f' (1: 0),
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders,
(Source code omitted for this binary file), "

在我的研究中,我发现问题与操作系统有关。有必要使用“npm install --arch = x64 --platform = linux sharp”来安装sharp。然而,问题仍在继续发生。

即使使用 linux x84_64 也会出现这个问题,有谁知道它可能是什么?

标签: node.jsamazon-web-servicesaws-lambdasharp

解决方案


推荐阅读