I'm developing a Serverless Framework application that is using the Node runtime and is deployed to AWS. One of my AWS Lambda functions uses the sharp library.
When I run the AWS Lambda function, the following error occurs:
'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.
I believe this error is occurring because when I run the sls deploy
command on my local computer, the application is packaged on macOS and then moved to AWS. I think the application needs to be packaged on an operating system using linux-x64
.
How can I deploy my Serverless Framework from my computer and still be able to use the sharp library?