Since yesterday, or the day before yesteraday, it's hard to tell, my Gitlab CI fails to build all of my sites using astro-imagetools with the following error:
[vite] Error when evaluating SSR module /builds/[path-to-project]/astro.config.mjs: failed to import "astro-imagetools"
|- Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'imagetools-core' imported from [path-to-project]
This error occurs only in the CI and is extremely odd, because nothing changed in this library, the project’s code or the version of Node, and even older versions of the library are affected, which makes it seem like the library isn’t the culprit, yet it is what node blames…
My initial research makes it seem like it may have something to do with sharp, but I can’t be sure about that either. What’s clear is that on the CI not all packages are installed, one of which is imagetools-core which this library depends on—however only optionally?
Adding imagetools-core to the project dependencies causes a similar error regarding sharp.
Is anyone able to reproduce this? What else could I try?
Edit:
I’ve been able to narrow down the problem further. It seems like it has to do with the Node-Version (in my case 18, perhaps even the specific docker image node:18-alpine). It works in 18.18 but not 18.19. The significant thing that changed in these versions is npm going from v9 to v10, so I’m guessing this has to do with the newer npm version and thus would be a bug in npm, right? Pinning the docker image of the CI to node:18.18-alpine seems to have fixed the issue.
I’m leaving this here in case somebody else bumps into this issue and is looking for a workaround. Plus it still seems odd to me that imagetools-core is an optional dependency for astro-imagetools. Feel free to close this issue if you feel like it pollutes the log.
Since yesterday, or the day before yesteraday, it's hard to tell, my Gitlab CI fails to build all of my sites using
astro-imagetools
with the following error:This error occurs only in the CI and is extremely odd, because nothing changed in this library, the project’s code or the version of Node, and even older versions of the library are affected, which makes it seem like the library isn’t the culprit, yet it is what node blames…
My initial research makes it seem like it may have something to do with
sharp
, but I can’t be sure about that either. What’s clear is that on the CI not all packages are installed, one of which isimagetools-core
which this library depends on—however only optionally?Adding
imagetools-core
to the project dependencies causes a similar error regardingsharp
.Is anyone able to reproduce this? What else could I try?
Edit:
I’ve been able to narrow down the problem further. It seems like it has to do with the Node-Version (in my case 18, perhaps even the specific docker image
node:18-alpine
). It works in 18.18 but not 18.19. The significant thing that changed in these versions isnpm
going from v9 to v10, so I’m guessing this has to do with the newer npm version and thus would be a bug in npm, right? Pinning the docker image of the CI tonode:18.18-alpine
seems to have fixed the issue.I’m leaving this here in case somebody else bumps into this issue and is looking for a workaround. Plus it still seems odd to me that
imagetools-core
is an optional dependency forastro-imagetools
. Feel free to close this issue if you feel like it pollutes the log.