Sharp: Build failing on Alpine Linux

Created on 7 Sep 2016  路  11Comments  路  Source: lovell/sharp

Hi,

Apologies for my lack of insight into why this is happening, all I can provide you is an error message, repro steps, and 'sharp isn't installing on alpine linux'.

The following commands produce the error message below. How can I begin to debug this further?

docker run -it alpine:edge /bin/ash

# inside container
apk add vips --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
apk add nodejs python
npm install sharp
/ # npm install sharp

> [email protected] install /node_modules/sharp
> node-gyp rebuild

ERROR: musl libc (x86_64) requires manual installation - please see http://sharp.dimens.io/en/stable/install/
gyp: Call to 'LDD_VERSION="musl libc (x86_64)
Version 1.1.14
Dynamic Program Loader
Usage: ldd [options] [--] pathname" node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/sharp
gyp ERR! node -v v6.5.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.
npm ERR! Linux 4.4.0-36-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "sharp"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
question

Most helpful comment

Updated Vips to 8.3.3 in the PR linked above. While the merge is pending you can use the built version from my locally-hosted repo, your build steps should work for the most part:

apk add vips-dev --update-cache --repository http://wjordan-apk.s3.amazonaws.com/ --allow-untrusted
apk add python nodejs g++ make
npm install sharp

For production use to minimize the build size, you might want to install a pre-built node-sharp package (I have a PR for this at alpinelinux/aports#30). I haven't updated this to 0.16.0 yet though.

All 11 comments

Hello, the version of vips in the Alpine "testing" repo is v8.3.1 but sharp v0.16.0 requires a minimum of v8.3.3. @wjordan is listed as the package maintainer so may be able to help.

@wjordan would really love some help here :) moving to production in the next two days and I don't have the requisite skills to solve this one!

Updated Vips to 8.3.3 in the PR linked above. While the merge is pending you can use the built version from my locally-hosted repo, your build steps should work for the most part:

apk add vips-dev --update-cache --repository http://wjordan-apk.s3.amazonaws.com/ --allow-untrusted
apk add python nodejs g++ make
npm install sharp

For production use to minimize the build size, you might want to install a pre-built node-sharp package (I have a PR for this at alpinelinux/aports#30). I haven't updated this to 0.16.0 yet though.

Appreciate your work, I'll give it a go. Thanks!

libvips v8.3.3 is now available via apk, thanks @wjordan

I don't believe this problem should be closed. It's not a vips issue.

In the error log, you'll see


ERROR: musl libc (x86_64) requires manual installation - please see http://sharp.dimens.io/en/stable/install/
gyp: Call to 'LDD_VERSION="musl libc (x86_64)
Version 1.1.14
Dynamic Program Loader
Usage: ldd [options] [--] pathname" node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1

Opening up binding.gyp you will eventually find the following command.

'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'

The pipe to true never succeeds so node-gyp throws us an exit 1.

db02d024bb15:~# ldd --version 2>&1
musl libc (x86_64)
Version 1.1.15
Dynamic Program Loader
Usage: ldd [options] [--] pathname
db02d024bb15:~# echo $?
1

db02d024bb15:~# ldd --version 2>&1 || true
musl libc (x86_64)
Version 1.1.15
Dynamic Program Loader
Usage: ldd [options] [--] pathname
db02d024bb15:~# echo $?
0

As an example, removing the LDD_VERSION= var check portion and then trying to npm install again will allow you to get further.

@pporada-gl the salient message is ERROR: musl libc (x86_64) requires manual installation. Alpine Linux currently provides libvips v8.3.3 via apk - http://pkgs.alpinelinux.org/packages?name=vips

@lovell We have vips in our container though.

db02d024bb15:~# apk info vips
vips-8.3.3-r0 description:
A fast image processing library with low memory needs

vips-8.3.3-r0 webpage:
http://www.vips.ecs.soton.ac.uk/

vips-8.3.3-r0 installed size:
2093056

This is not a vips issue. I believe it's a node-gyp shell out issue.

@pporada-gl Which version of sharp are you using?

I have forked from master earlier this morning and am on v0.17.0. I get failures later on during the build about vips 8.4.x, but can at least get past the ldd problem on my fork.

@pporada-gl The forthcoming, yet-to-be-published v0.17.0 of sharp will require libvips v8.4.2+ - see https://github.com/lovell/sharp/blob/master/package.json#L88

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OleVik picture OleVik  路  3Comments

zhump picture zhump  路  3Comments

Andresmag picture Andresmag  路  3Comments

vermin1337 picture vermin1337  路  3Comments

henbenla picture henbenla  路  3Comments