Sharp package Heroku deployment issue

There are many people with that problem, it's related to libvips as dependency not sharp by itself.

On github in this issue-comment the problem is explained:

The pre-built binaries of sharp are only guaranteed to work with the pre-built binaries of libvips.

If the download of a pre-built binary of libvips fails then sharp has to fall back to attempting to build itself from source.

http://sharp.pixelplumbing.com/en/stable/install/#pre-compiled-libvips-binaries provides information about serving the libvips binaries from a local URL.

The reason why the download is failing might be the cache, or a corrupted download like reported in the above linked issue on github:

I had to manually remove the ~/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz and try again. Seems to be downloaded a corrupted file.

Here is an interesting discussion concerning the same problem related to gatsby, a solution seems not yet existing even the issue was closed (before any comment was made): https://github.com/gatsbyjs/gatsby/issues/1754

However if the problem is only related to the download for some reason it's possible to deploy libvips locally like explained in the manual:

Pre-compiled libvips binaries
This module will attempt to download a pre-compiled bundle of libvips and its dependencies on Linux and Windows machines under either of these conditions:

  • If a global installation of libvips that meets the minimum version
    requirement cannot be found;
  • If SHARP_IGNORE_GLOBAL_LIBVIPS environment variable is set.
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install sharp  

Should you need to manually download and inspect these files,
you can do so via https://github.com/lovell/sharp-libvips/releases

Should you wish to install these from your own location, set the
sharp_dist_base_url npm config option, e.g.

npm config set sharp_dist_base_url "https://hostname/path/" 
npm install sharp 

or set the SHARP_DIST_BASE_URL environment variable, e.g.

SHARP_DIST_BASE_URL="https://hostname/path/" npm install sharp

to use https://hostname/path/libvips-x.y.z-platform.tar.gz.

So this is a bit background, I'm aware that this can not really be seen as an answer with solution :/