Sunday, 3 November 2019

How to fix libpng12.so.0: cannot open shared object file in node10.x lambda?

I've da Dockerfile:

FROM lambci/lambda:build-nodejs10.x
RUN yum update -y
RUN yum -y install libpng12.so.0 libpng12-devel

I build the image and I perform and mount my node app inside the image and I perform an npm install.

This are the deps:

  "dependencies": {
    "imagemin": "^5.3.1",
    "imagemin-pngquant": "^5.1.0",
    "sharp": "^0.22.1"
  },
  "devDependencies": {
    "aws-sdk": "^2.36.0"
  }

The npm install works (but only when I install libpng12-devel inside my docker container): + npm i

> sharp@0.22.1 install xxx/resize/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-linux-x64.tar.gz

> pngquant-bin@4.0.0 postinstall xxx/resize/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully
added 434 packages from 280 contributors and audited 1798 packages in 36.268s
found 7 vulnerabilities (2 low, 3 moderate, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details

When I deploy my app (a lambda) and start doing some testing I see this in CloudWatch:

"code": "EPIPE",
"stack": [
    "Error: /var/task/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory",
    "",
    "    at WriteWrap.afterWrite [as oncomplete] (net.js:788:14)"
],

How can I fix this? I've installed libpng12?



from How to fix libpng12.so.0: cannot open shared object file in node10.x lambda?

No comments:

Post a Comment