Sharp: Azure installation error

Created on 2 Mar 2019  路  4Comments  路  Source: lovell/sharp

I'm getting an error:
'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.

node_modules is being created and installed in destination.
How do I use sharp in Azure?

question

Most helpful comment

Update 15 July 2019: It looks like this issue has been resolved so the hack is no longer needed. I just started getting the following error but the issue was resolved once the hack had been removed.

libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

_No longer needed but I'll leave here for reference purposes_

If it's any use, I had the same issue and I found a solution (I'm assuming you're using the Azure Web Apps like me). For some reason it seems to download the dependencies on one Linux environment but run the app on another. Anyway, I was able to resolve the issue by adding the following "postinstall" script to my package.json file.

"scripts": {
    "build:azure" : "npm install --arch=x64 --platform=linuxmusl sharp"
}

This should install the _linuxmusl_ version of _libvips_, ready to be used when the app is run.

Note: I've updated this comment as I was previously using the "postinstall" phase to install the correct version. This didn't seem to cause any issues in development but it seems more elegant to use "build:azure" (which I discovered on the Oryx Node readme).

All 4 comments

Hello, this message means that a musl-based Linux, probably Alpine, is being used at runtime but a glibc-based Linux was used at npm install time. Try using a musl-based Linux at npm install time or a glibc-based Linux at runtime so they match.

Hope this solved your problem, please re-open with more details if further help is required.

Update 15 July 2019: It looks like this issue has been resolved so the hack is no longer needed. I just started getting the following error but the issue was resolved once the hack had been removed.

libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

_No longer needed but I'll leave here for reference purposes_

If it's any use, I had the same issue and I found a solution (I'm assuming you're using the Azure Web Apps like me). For some reason it seems to download the dependencies on one Linux environment but run the app on another. Anyway, I was able to resolve the issue by adding the following "postinstall" script to my package.json file.

"scripts": {
    "build:azure" : "npm install --arch=x64 --platform=linuxmusl sharp"
}

This should install the _linuxmusl_ version of _libvips_, ready to be used when the app is run.

Note: I've updated this comment as I was previously using the "postinstall" phase to install the correct version. This didn't seem to cause any issues in development but it seems more elegant to use "build:azure" (which I discovered on the Oryx Node readme).

Thanks @itip, will try it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulieo10 picture paulieo10  路  3Comments

Andresmag picture Andresmag  路  3Comments

jaekunchoi picture jaekunchoi  路  3Comments

iq-dot picture iq-dot  路  3Comments

tomercagan picture tomercagan  路  3Comments