image
image copied to clipboard
[@nuxt/image] Unexpected response IPX Error (500) when running in Github Actions
When running our action to generate and deploy our static site, we get the error above. It only happens in Github Actions, locally (on multiple different machines) it works.
An example usage of an image is
<nuxt-img
src="/images/my-img.png"
alt="Image"
format="webp"
width="1200"
quality="100"
loading="lazy"
/>
The nuxt config looks like this:
export default {
ssr: true,
target: 'static',
buildModules: ['@nuxt/postcss8', 'nuxt-facebook-pixel-module', '@nuxt/image'],
image: {
provider: 'static',
},
// rest omitted...
The command we're running is nuxt generate
In https://github.com/nuxt/image/issues/250 he seemed to get the same error and it had something todo with the images not being on the file system? I tried to check that in the Action runner via tree
unix command and they all appear to be there under ./static/images/etc.png
.
We've tried both version 0.7.1 and 0.6.2. Both resulted in the same error.
The version of nuxt is 2.15.8
Any help would be greatly appreciated!
Im looking for help on this issue as well, it's causing some of our CI pipelines to continue without failure? Even when running with nuxt generate --fail-on-error
:confused:
We figured it out.
We had cached our node_modules
in the Action. However we hadn't included the OS in the cache key. So I imagine the issue was that the Sharp version wasn't installed with linux binaries.
Our current step looks like this:
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
My issue was that the filename was image.PNG
, but I used image.png
in the code. Windows does not differentiate between uppercase and lowercase letters so it worked locally. However, image.png
doesn't exist in a Linux environment. rename your images.
+1
+1
Same problem here, I am trying to use the default nuxt/image config, and for the images that come from ipx http://localhost:3000/_ipx/s_328x224/images/banner/1.jpg
for example I got the error 500 and missing sharp:
{
"error": {
"message": "
[500] [IPX_ERROR] \nSomething went wrong installing the \"sharp\" module\n\nCannot find module
'../build/Release/sharp-linux-x64.node'\nRequire stack:\n- /home/.../node_modules/sharp/lib/sharp.js\n-
/home/.../node_modules/sharp/lib/constructor.js\n- /home/.../node_modules/sharp/lib/index.js\n\nPossible solutions:\n-
Install with verbose logging and look for errors: \"npm install --ignore-scripts=false --foreground-scripts --verbose sharp\"\n
- Install for the current linux-x64 runtime: \"npm install --platform=linux --arch=x64 sharp\"\n-
Consult the installation documentation: https://sharp.pixelplumbing.com/install"
}
}
In my case, I am working on WSL-Ubuntu and I also tried to deploy to vercel and there it worked fine. Just in localhost that not work.
+1 same issue here, testing local with a default nuxt install
I hope to reopen this question. I am using node20x and nuxt3.8. After the build, the local png image part will have this problem, but the local svg and remote jpg will have no problem.
+1 here. I reverted my yarn.lock file and it started to work again. Not sure if this has been an error in the recent releases.
I hope to reopen this question. I am using node20x and nuxt3.8. After the build, the local png image part will have this problem, but the local svg and remote jpg will have no problem.
I solved this problem by installing the sharp dependency in the project.
For me it works on Vercel when i deploy, but not locally, i tried installing sharp dependency but didn´t work as well
yarn add sharp --ignore-engines
this command make it work for me, i was missing this 'ignore-engines 'prefix
This is still a problem in 2024 and I have no choice but to install sharp again and again.