error while loading shared libraries: libpng16.so.16

Pavel picture Pavel · Feb 23, 2018 · Viewed 7.4k times · Source

The problem is that I'm trying to use nodejs for building some css files from scss. On the local computer everything is ok.

When I run npm run production it shows me the error:

ERROR in ./resources/assets/sass/images/promo.jpg
Module build failed: Error: Command failed: /var/www/vhosts/site.ru/shared/node_modules/mozjpeg/vendor/cjpeg
/var/www/vhosts/site.ru/shared/node_modules/mozjpeg/vendor/cjpeg: error while loading 
shared libraries: libpng16.so.16: cannot open shared object file: No such file or 
directory

But when I run the same command from another directory(For example: /var/www/vhosts/site2.ru/) everything is ok(script works with jpg files too).

If I run ldconfig -p | grep libpng I see the next:

 libpng12.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libpng12.so.0
 libpng12.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpng12.so.0

So, my Libng12 is working correctly, why does the system needs in libpng16? And what should I try do in this situation?

My system is Ubuntu 16.04

Answer

Pavel picture Pavel · Feb 23, 2018

Find the solution: apt-get install libpng16-dev so, I just installed the required library.