title: Problem running AWS Lambda function with Sharp library
body: <p>I created a lambda function through the aws-amplify CLI by following an AWS workshop (<a href="https://amplify-workshop.go-aws.com/70_generating_thumbnails/10_creating_a_photo_processor_lambda.html" rel="nofollow noreferrer">https://amplify-workshop.go-aws.com/70_generating_thumbnails/10_creating_a_photo_processor_lambda.html</a>).  Seems that there is a problem with conflicting versions of Node.js somewhere.</p>
  
  <p>I believe that the sharp library is the problem, so I have tried to change the version to the latest to see if that would do anything, but it did not fix the issue.</p>
  
  <p>CloudWatch error log:</p>
  
  <pre><code>module initialization error: Error
  was compiled against a different Node.js version using
  NODE_MODULE_VERSION 67. This version of Node.js requires
  NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
  the module (for instance, using `npm rebuild` or `npm install`).
  at Object.Module._extensions..node (module.js:681:18)
  at Module.load (module.js:565:32)
  at tryModuleLoad (module.js:505:12)
  at Function.Module._load (module.js:497:3)
  at Module.require (module.js:596:17)
  at require (internal/module.js:11:18)
  at Object.&lt;anonymous&gt; (/var/task/node_modules/sharp/lib/constructor.js:10:15)
  at Module._compile (module.js:652:30)
  at Object.Module._extensions..js (module.js:663:10)
  at Module.load (module.js:565:32)
  </code></pre>
  
  <p>I believe there is a simple fix, but I am unsure where the source of the problem lies.  Thank you.</p>