Sharp module installation error
I encountered the following error whilst upgrading Gatsby to v4 and dockerising it. Locally, no problem but within Docker, problema.
Error: Something went wrong installing the "sharp" moduleMy local was running on Ubuntu/Windows WSL node 17, and Docker was running node:17-alpine.
I tried the following suggested solutions in the developer internet but they didn’t work.
-
RUN npm rebuild sharp -
RUN npm install --ignore-scripts=false sharp
The other suggestion was to downgrade, and I wasn’t willing to so I thought maybe the problem is alpine? So I decided to drop alpine and its benefits and just get the direct node:17
From node:17It worked, and that’s all I needed. (For future readers, the issue was probably platform-specific support issue for the particular sharp module especially if the module’s version was experimental or the linux platform just has poor support for it, I did not investigate any further)