Open vilelalabs opened 1 year ago
same issue with useContext null. Not present in 13.3
I returned to project and got this too:
Import trace for requested module:
./node_modules/next/dist/server/future/helpers/interception-routes.js
./node_modules/next/dist/client/components/router-reducer/compute-changed-path.js
./node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js
./node_modules/next/dist/client/components/app-router.js
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could
happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
- error TypeError: Cannot read properties of null (reading 'useContext')
[update 23/06/23]
I returned I third time to this project and erase node_modules folder and did npm install
again , then worked fine.
But when I started a new project It came with this same fails again.
[update 24/06/23] On next day I restarted project, and problem is back, I tried to remove node_modules and reinstall, but this time didn't solve, problem persists. but without last line about useContext
(...)
(same lots of error described before ...)
(...)
# end of errors is:
Import trace for requested module:
./node_modules/next/dist/server/future/helpers/interception-routes.js
./node_modules/next/dist/client/components/router-reducer/compute-changed-path.js
./node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js
./node_modules/next/dist/client/components/app-router.js
I notice that may be related to VSCode in some way.
If VSCode is opened I have this problem, but if I start project with npm run dev
in a separated terminal and after that I open VSCode, it works without problem. If I open in separated terminal and VSCode is open, I get errors or if I try to open using terminal inside VSCode. (both, inside VSCode and on terminal I use git bash (latest) as terminal).
I didn’t have issues running in dev mode. Not even from vscode. Only with prod builds.
did you manage to figured it out?
@pacelliv Not exactly. I changed my OS from Windows 10 to full Linux (Mint 21) deveplopment and didn't had this issues never more.
At least in my case it wasn't a Nextjs issue but rather a mistake in the capitalization of the path shown in my terminal. For example, the actual path of the project is C:\Users\MyUser\Documents\dev\university\homeworks
but in my terminal the path was C:\Users\MyUser\documents\dev\university\homeworks
.
After updating documents
to Documents
the issue was solved.
@pacelliv Thanks a lot, that fixed it for me
@pacelliv Thank you, it works, I wonder why VSCode doesn't set Documents by default
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template
To Reproduce
the code is just the provided. ANY change was made to original code that comes with create-next-app install
tested on:
commands used:
or (with create-next-app@13.4.7-canary.0)
on both, options were:
the code is just the provided. ANY change was made to original code that comes with create-next-app install
Describe the Bug
When running npm run dev I get this big errors/warnings in console: The part: There are multiple modules.... repeates at least 30 times more (I hidded due limits on writing issue here)
PS: npm run build shows same errors PS2: npm run start shows: errors:
Error occurs when browser is opened on localhost:3000 or on page refresh
Expected Behavior
Expected no errors, just webpage opening rightly on browser.
Which browser are you using? (if relevant)
Chrome 114.0.5735.134, Edge 114.0.1823.43
How are you deploying your application? (if relevant)
no deploy