-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Latest docker build breaks node-gyp in node-18 #2009
Comments
Is it somehow missing python from the install? |
We had the latest node:18-alpine image (now pointing to node:18-alpine3.19 instead of node:18-alpine3.18) segfault and had to hardcode not to use the 18-alpine tag but specifically the alpine3.18 based one. Maybe related? |
I can't be very specific publicly, but two of our use cases using the alpine3.19 based node:18 image always exited with |
Had same issues with Sharp too, maybe some compilation libraries (libc, musl) are outdated or updated?
Is there any version I can downgrade for now? I can't get the specific tag, but it seems to be this digest which was working for me: |
I downgraded to |
Ah, for some, this looks like a sharp module incompatibility with the newer https://github.com/lovell/sharp/blob/v0.30.7/package.json#L157 I think just updating your sharp dependency should be enough in some cases: $ docker run --rm node:18-alpine3.19 npm install -g sharp@0.30
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: Invalid Version: 1.2.4_git20230717
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-13T19_14_03_677Z-debug-0.log
$ docker run --rm node:18-alpine3.19 npm install -g sharp@0.31
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: Invalid Version: 1.2.4_git20230717
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-13T19_14_11_327Z-debug-0.log
$ docker run --rm node:18-alpine3.19 npm install -g sharp@0.32
added 51 packages in 3s
$ docker run --rm node:18-alpine3.19 npm install -g sharp@0.33
added 15 packages in 2s |
I confirm the problem using node:18-alpine3.19 Running npm ERR! code 1
npm ERR! path /usr/src/app/node_modules/sharp
npm ERR! command failed
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: Invalid Version: 1.2.4_git20230717 Downgrade to node:18-alpine3.18 it works. |
This is happening when node and sharp versions mismatch in my case. So I recommend trying to install both node and sharp latest versions. Either try downgrading both node and sharp versions as for your needs. In my case, node 16 and sharp 0.30.3 work fine. But sharp 0.30.3 doesn't work with node 20. |
Changing image from |
Why do I still get an error after changing it to node:18-alpine3.18? |
I am using image node:20-alpine3.18 from node:18-alpine works for me.. |
It works for me also with node:18-alpine3.18. Hopefully, this will be fixed in the next releases. |
The Alpine image never supported node-gyp building without additional packages being added. Instructions can be found here https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine |
Related issue: nodejs/docker-node#2009
@nschonni I tried following those instructions using |
For me it worked by changing the alpine version to 3.18. Dockerfile: |
working on |
…unix Originally, I stumbled on an error with `../src/pipeline.cc` where it complained about an invalid struct type. After some searching I found the issue: The current image used as base in the Dockerfile example links to an alpine-linux version **later** than 3.18, which has made changes in `libvips`, as discussed in this PR: [Link](nodejs/docker-node#2009) The PR also mentions, that fixing the build to version 3.18 resolve the issue, which I also confirmed in my local setup when trying to deploy strapi through docker compose.
…unix (#2063) Originally, I stumbled on an error with `../src/pipeline.cc` where it complained about an invalid struct type. After some searching I found the issue: The current image used as base in the Dockerfile example links to an alpine-linux version **later** than 3.18, which has made changes in `libvips`, as discussed in this PR: [Link](nodejs/docker-node#2009) The PR also mentions, that fixing the build to version 3.18 resolve the issue, which I also confirmed in my local setup when trying to deploy strapi through docker compose.
node18-alpine3.18 is required, to avoid node-gyp errors, see nodejs/docker-node#2009
bumping the resolution for sharp to 0.33 removes the need to pin alpine 3.18. (See nodejs/docker-node#2009) Without resolution, sharp is fixed to 0.28.3 which clashes with the libvips for newer alpines.
still get the error when I use |
To resolve this, you need to ensure that Python is installed and available in the Docker image. Add the following to your Dockerfile
This worked for me. |
Environment
(This happens inside my managed CI provider, not sure on its version)
Current Behavior
When I install sharp, it fails due to node gyp:
This was working yesterday and seems to coincide with this build going live:
When I stick my docker version to the node:18-alpine3.18 it works again.
The text was updated successfully, but these errors were encountered: