'Cannot find module fluent-ffmpeg' 在 AWS Lambda 上

'Cannot find module fluent-ffmpeg' on AWS Lambda

我是 运行 AWS Lambda 上的视频处理脚本。

虽然它似乎在本地完美运行(使用 lambda-local 测试),但当它在 Lambda 上运行时我遇到了一个奇怪的问题:

{
  "errorMessage": "Cannot find module 'fluent-ffmpeg'",
  "errorType": "Error",
  "stackTrace": [
    "Function.Module._resolveFilename (module.js:338:15)",
    "Function.Module._load (module.js:280:25)",
    "Module.require (module.js:364:17)",
    "require (module.js:380:17)",
    "Object.<anonymous> (/var/task/processing.js:2:14)",
    "Module._compile (module.js:456:26)",
    "Object.Module._extensions..js (module.js:474:10)",
    "Module.load (module.js:356:32)",
    "Function.Module._load (module.js:312:12)",
    "Module.require (module.js:364:17)"
  ]
}

我正在上传的 ZIP 包含以下文件:

~$ find . -maxdepth 2
.
./bin
./bin/ffmpeg
./config.js
./event-samples
./event-samples/custom.js
./event-samples/dynamodb-update.js
./event-samples/kinesis.js
./event-samples/s3-put.js
./frames
./Gulpfile.js
./index.js
./node_modules
./node_modules/async
./node_modules/aws-sdk
./node_modules/fluent-ffmpeg
./node_modules/gulp
./node_modules/gulp-awslambda
./node_modules/gulp-zip
./package.json
./processing.js
./utils.js

(越野车要求位于processing.js

如果我打开 ZIP,node_modules/fluent-ffmpeg/* 确实存在。

我尝试使用以下方法包含该模块:

但是其中 none 解决了问题。我还尝试在我的机器上重新安装节点和 npm,rm -rf node_modulesnpm install(以防万一)。

由于 Lambda 运行 Node 0.10.36,我也尝试在我的机器上使用这个版本来执行 npm install,但这也没有改变任何东西。

感谢帮助。

谢谢!

已解决。我的开发机器运行 Windows 7,这显然是导致问题的原因......不过会对原因感兴趣。

无论如何,运行 npm install linux 安装并将代码上传到 Lambda 就成功了。