Next.js Discord

Discord Forum

Nextjs 14.1.0 encountering build error: Attempted import error: 'useEffect' is not exported

Sussex Spaniel posted this in #help-forum
Open in Discord
Sussex SpanielOP
I recently ran into a ton of issues regarding builds working locally but failing on vercel, managed to fix it by downgrading sharp. Now that the new version of next has been released, and states that they support the newest version of sharp locally and remotely on vercel, I upgraded, but now I am unable to build my app, which was previously building just fine, help would be appreciated, I've been down this rabbit hole for a few hours now.

11 Replies

Sussex SpanielOP
The build error is regarding react-query, it's saying that useEffect is not exported from react, even though the library itself contains the proper 'use client' header, and I properly placed the QueryProvider element in it's own component with another use client header.
Sussex SpanielOP
Downgrading to next 14.0.0 worked, I suppose that should help for the time being
14.0.3 worked
14.0.4 worked
Just going to leave it on 14.0.4 for now, not worth the headache trying to figure out why 14.1.0 broke it
if anyone wants to try to figure it out by all means let me know what you think, maybe someone else is running into this, so I'll keep this thread open
aaand it doesn't work on vercel... going to just try 14.0.0
had to downgrade sharp to 0.33.1 due to vercel bug
work pls
this again 😢

Error: Could not load the "sharp" module using the linux-x64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
    yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
- Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
    npm install --force @img/sharp-linux-x64
- Consult the installation documentation:
    at Object.<anonymous> (/var/task/node_modules/sharp/lib/sharp.js:107:9)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at r.<computed>.e._load (/var/task/___vc/__launcher/bridge-server-72TT5FOD.js:1:1574)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at w.require (/var/task/node_modules/next/dist/compiled/next-server/
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:10:1)
Sussex SpanielOP
That bug originally listed happens in dev too, yikes