I am using lambda with node 10 or 12, and Sharp dos not install correctly, it show this error:
undefined ERROR
Something went wrong installing the "sharp" module
Module did not self-register.
My node local is 13, and npm install does not show errors.
What is the output of running npx envinfo --binaries --languages --system --utilities?
$ npx envinfo --binaries --languages --system --utilities
npx: instalou 1 em 1.295s
System:
OS: Linux 5.3 Arch Linux
CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
Memory: 2.11 GB / 15.65 GB
Container: Yes
Shell: 5.0.11 - /bin/bash
Binaries:
Node: 13.1.0 - /usr/bin/node
Yarn: 1.19.1 - /usr/bin/yarn
npm: 6.12.1 - /usr/bin/npm
Utilities:
Make: 4.2.1 - /usr/bin/make
GCC: 9.2.0 - /usr/bin/gcc
Git: 2.24.0 - /usr/bin/git
FFmpeg: 4.2.1 - /usr/bin/ffmpeg
Languages:
Bash: 5.0.11 - /usr/bin/bash
Perl: 5.30.1 - /usr/bin/perl
PHP: 7.3.12 - /usr/bin/php
Python: 3.8.0 - /usr/bin/python
Python3: 3.8.0 - /usr/bin/python3
Ruby: 2.5.1 - /home/terabytes/.rbenv/shims/ruby
I can fix my problem done a downgrade of local node installation to node 10.
Downgrade to Node 12 does not work.
Using the latest Node 13 locally does not work, because lambda are using Node 10 or 12.
Have you ensured the platform and version of Node.js used for npm install is the same as the platform and version of Node.js used at runtime?
https://sharp.pixelplumbing.com/en/stable/install/#aws-lambda
I done with node 12 localy and node 12 on lambda, and it does not work.
Works only when I put node 10 localy, and node 10 on lambda.
Thanks.
Just noting that running npm install as follows in an Ubuntu 18 container results in a successful result when the node_modules are deployed to and run in AWS Lambda nodejs12.x:
npm install --arch=x64 --platform=linux --target=12.13.1 sharp
@matthewberryman this solved it for me running node 12.x in lambda and needing sharp, building on mac OSX
@matthewberryman solved it for me too. Ty. had to do node -v and just put that version number in.
On macos catalina:
Installed libvips using brew install vips. Sharp loads locally. Then I tried the above. No dice 馃槩
Most helpful comment
Just noting that running npm install as follows in an Ubuntu 18 container results in a successful result when the node_modules are deployed to and run in AWS Lambda nodejs12.x:
npm install --arch=x64 --platform=linux --target=12.13.1 sharp