Next.js 15 server crashes with segmentation fault on Linux when loading images (works with sudo or unoptimized: true) #84536
Unanswered
pawelgontarz
asked this question in
Help
Replies: 1 comment 4 replies
-
Have you done I'll try to search around a bit more too. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I'm having a really weird issue with Next.js 15.2.3 on Linux Ubuntu 22(Node 22.20.0, pnpm 10.18.0). My dev server compiles fine, but when I navigate to any page with
next/image
components, I get a chunk loading error in the browser and the dev server just exits without any error message.Here's the strange part - it works perfectly if I either:
sudo pnpm run dev
images: { unoptimized: true }
in next.config.tsThe browser error looks like this:
And the terminal just shows:
No error, it just exits. If I curl the page from the terminal it works fine - the issue only happens when loading in a browser, which I assume triggers the image optimization.
Even worse, when I try to run production mode (
pnpm build && pnpm start
), I get a segmentation fault:My next.config.ts is pretty simple:
I'm running with Turbopack (
next dev --turbo
) but the issue happens without it too.Sharp is installed at
node_modules/.pnpm/[email protected]/node_modules/sharp/
and all the permissions look correct - everything is owned by my user, not root.Things I've already tried:
chmod -R u+rwX node_modules
andchown -R $USER:$USER
The fact that it works with sudo but not as a regular user suggests some kind of permissions issue, but I can't figure out what permission is missing. The segmentation fault in production is really concerning and makes me think this might be an issue with Sharp's native binaries on Linux rather than just permissions.
Has anyone encountered something similar? This is driving me crazy because the exact same code works perfectly on Windows.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions