TypeError: Cannot read properties of undefined (reading 'document')
Unanswered
Jojok posted this in #help-forum
JojokOP
Hi I just upated to Next 14 and now I'm getting the error below when I run and when I build.
The line it refers to is a use context import
The line it refers to is a use context import
import { PinContext } from "~@/app/context/PinContext"; node_modules\jquery\dist\jquery.js (27:26) @ document
⨯ TypeError: Cannot read properties of undefined (reading 'document')
at __webpack_require__ (C:\Users\asus\OneDrive\Desktop\projects\palfly-site\.next\server\webpack-runtime.js:33:42)
at __webpack_require__ (C:\Users\asus\OneDrive\Desktop\projects\palfly-site\.next\server\webpack-runtime.js:33:42)
at __webpack_require__ (C:\Users\asus\OneDrive\Desktop\projects\palfly-site\.next\server\webpack-runtime.js:33:42)
at eval (./components/FlightResultDetails.tsx:12:83)
at (ssr)/./components/FlightResultDetails.tsx (C:\Users\asus\OneDrive\Desktop\projects\palfly-site\.next\server\app\page.js:228:1)
at __webpack_require__ (C:\Users\asus\OneDrive\Desktop\projects\palfly-site\.next\server\webpack-runtime.js:33:42)
at eval (./components/FlightResult.tsx:12:78)4 Replies
Is, by any chance the import included in a server component?
@Jojok
JojokOP
Thanks @Stoyan Paskalev no it's client both importing and being imported. I think I actually just solved the problem. I was using a very old npm that needed jquery. I just replaced that package and I think it's okay now.
Glad to hear this. Cheers!