Internal error: ReferenceError: document is not defined at getUrlBasedHistory
Unanswered
Cuban Crocodile posted this in #help-forum
Cuban CrocodileOP
when i run the next js project , it shows this error in terminal i dont know what to do how to fix this error please help me
⨯ Internal error: ReferenceError: document is not defined
at getUrlBasedHistory (./node_modules/@remix-run/router/dist/router.js:372:14)
at createBrowserHistory (./node_modules/@remix-run/router/dist/router.js:226:10)
at BrowserRouter (./node_modules/react-router-dom/dist/index.js:673:92)
⨯ Internal error: ReferenceError: document is not defined
at getUrlBasedHistory (./node_modules/@remix-run/router/dist/router.js:372:14)
at createBrowserHistory (./node_modules/@remix-run/router/dist/router.js:226:10)
at BrowserRouter (./node_modules/react-router-dom/dist/index.js:673:92)
2 Replies
@Cuban Crocodile when i run the next js project , it shows this error in terminal i dont know what to do how to fix this error please help me
⨯ Internal error: ReferenceError: document is not defined
at getUrlBasedHistory (./node_modules/@remix-run/router/dist/router.js:372:14)
at createBrowserHistory (./node_modules/@remix-run/router/dist/router.js:226:10)
at BrowserRouter (./node_modules/react-router-dom/dist/index.js:673:92)
it looks like you accessing the
For example inside a useEffect, or you wrap it inside an
document inside a client component before it's mounted. Make sure you only use the document variable, after the component is mounted.For example inside a useEffect, or you wrap it inside an
if statement like typeof document !== undefined@Cuban Crocodile solved?