Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Internal Server Error Invalid Hook Calls #38

Closed
ondrovic opened this issue Dec 16, 2020 · 2 comments
Closed

[BUG]: Internal Server Error Invalid Hook Calls #38

ondrovic opened this issue Dec 16, 2020 · 2 comments

Comments

@ondrovic
Copy link

Steps to reproduces

  1. clone repo (git clone https://github.com/jaydenseric/apollo-upload-examples.git)
  2. cd apollo-upload-examples/app/
  3. npm install
  4. npm run dev
  5. Navigate to http://localhost:3000 in browser

Expected Behavior
Navigate to site and test

Actual Results

Internal Server Error with

Error: 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://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
    at resolveDispatcher (C:\users\ondro\Desktop\apollo-upload-examples\app\.next\server\pages\_document.js:3363:13)
    at useContext (C:\users\ondro\Desktop\apollo-upload-examples\app\.next\server\pages\_document.js:3371:20)
    at Html (C:\users\ondro\Desktop\apollo-upload-examples\app\.next\server\pages\_document.js:330:29)
    at processChild (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\react-dom\cjs\react-dom-server.node.development.js:3043:14) 
    at resolve (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\react-dom\cjs\react-dom-server.node.development.js:2960:5)       
    at ReactDOMServerRenderer.render (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\react-dom\cjs\react-dom-server.node.development.js:3435:22)
    at ReactDOMServerRenderer.read (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\react-dom\cjs\react-dom-server.node.development.js:3373:29)
    at renderToStaticMarkup (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\react-dom\cjs\react-dom-server.node.development.js:4004:27)
    at renderDocument (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\next\dist\next-server\server\render.js:3:669)
    at renderToHTML (C:\Users\ondro\Desktop\apollo-upload-examples\app\node_modules\next\dist\next-server\server\render.js:52:103)
@jaydenseric
Copy link
Owner

Are you using npm v7? The lockfile is v2, generated by npm v7 so using npm v6 might run into trouble.

It was already documented in the readme to use the latest npm:

https://github.com/jaydenseric/apollo-upload-examples/blame/eed3e3109caa0682b7485a04467cc73abf44c2bc/app/readme.md#L11

But to be even clearer I also just added npm to the package engines fields:

Hopefully this was your issue 🤞

@ondrovic
Copy link
Author

ondrovic commented Dec 17, 2020

Yep using the following
NPM: 7.0.9
Node: 14.15.1

adding seemed to resolve the issue
"npm": ">= 7"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants