Build error in vercel when deploying TypeError: Cannot read properties of null (reading 'useContext'
Unanswered
Gazami crab posted this in #help-forum
Gazami crabOP
TypeError: Cannot read properties of null (reading 'useContext')
at t.useContext (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109363)
at d (/vercel/path0/.next/server/chunks/881.js:1:34783)
at h (/vercel/path0/.next/server/chunks/881.js:1:26707)
at au (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:10446)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:15122
at aw (/vercel/path0/nodemodules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16908)
at a (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:49776)
at ab (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:11808)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16871
at aw (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16908)
at t.useContext (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:109363)
at d (/vercel/path0/.next/server/chunks/881.js:1:34783)
at h (/vercel/path0/.next/server/chunks/881.js:1:26707)
at au (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:10446)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:15122
at aw (/vercel/path0/nodemodules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16908)
at a (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:49776)
at ab (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:11808)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16871
at aw (/vercel/path0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:16908)
92 Replies
Gazami crabOP
can any one please help
Bicknell's Thrush
Looks to me like a client component being used on a server context. But with just the log, there is not much to go on.
Gazami crabOP
i am using shadcn. corousel component. "use client"; is been mentioned in that component . i dont have issues in local build . this is only in vercel @Bicknell's Thrush
this is my package.json
Gazami crabOP
its below
the corousel is using in this component @gin
@Gazami crab i can help u out if u want to hop in a screen share rq
its better for me to directly see the problem
Gazami crabOP
@gin that would be very helpful could you tell when will you be free so that we can connect on your time
get this and tell me your code
Gazami crabOP
hi. 1 799 401 675. @gin
only accept mouse and keyboard perms
Gazami crabOP
i tried to lower version of next
it didnte work
dont move ur mouse but it will be slow cause its lagging for me
try building
npm run build
Gazami crabOP
ok
its working?
Gazami crabOP
actually build issue is on vercel deployment
Gazami crabOP
on sec let me reset it for you
where i got the error
Gazami crabOP
when i searched on google some people solved it by down grading
put your next to the latest version
and push
Gazami crabOP
ok
show me your package json
Gazami crabOP
ok
Gazami crabOP
this is the error iam trying to solve
Gazami crabOP
i didnt get it
go inse your useCarousel hook
where u define it
Gazami crabOP
this?
Gazami crabOP
can you take over
its extremely laggy
can u log
Gazami crabOP
ok
where you reference your context
Gazami crabOP
what to do
Gazami crabOP
ok
done
now try
push that
Gazami crabOP
it didnt work befor thats why i tried " ? ".
did u follow some kind of tutorial?
Gazami crabOP
no, i imported shad cn corousel
i think u messed up something with how you use your provider
since u need to wrap your provider within your layout
and only then use the context
Gazami crabOP
oh k, let me try to fix it. if i cant by to night . i will message you
alr
Gazami crabOP
thank you so much for your time @gin
Dickcissel
I am having the same issue, brand new project, blank layout and page files
node version is 20.14.0
Dickcissel
and this only happens inside my turborepo, standalone same files builds fine
Golden northern bumble bee
This happens to me as well, can not build