Как исправить проблему с версией nodejs в функции Aws-lambda - PullRequest
0 голосов
/ 10 июля 2019

Я пытаюсь изменить размеры своих изображений с помощью Aws lambda и получаю ошибку и я следую за этой статьей

https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/

{
  "errorType": "Error",
  "errorMessage": "The module '/var/task/node_modules/sharp/build/Release/sharp.node'\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION 48. This version of Node.js requires\nNODE_MODULE_VERSION 64. Please try re-compiling or re-installing\nthe module (for instance, using `npm rebuild` or `npm install`).",
  "trace": [
    "Error: The module '/var/task/node_modules/sharp/build/Release/sharp.node'",
    "was compiled against a different Node.js version using",
    "NODE_MODULE_VERSION 48. This version of Node.js requires",
    "NODE_MODULE_VERSION 64. Please try re-compiling or re-installing",
    "the module (for instance, using `npm rebuild` or `npm install`).",
    "    at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)",
    "    at Module.load (internal/modules/cjs/loader.js:600:32)",
    "    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:531:3)",
    "    at Module.require (internal/modules/cjs/loader.js:637:17)",
    "    at require (internal/modules/cjs/helpers.js:22:18)",
    "    at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:8:15)",
    "    at Module._compile (internal/modules/cjs/loader.js:701:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)",
    "    at Module.load (internal/modules/cjs/loader.js:600:32)"
  ]
}
...