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

ERROR Cannot read properties of null (reading 'useContext') [Fresh Installation] #490

Closed
1 task done
faridmovsumov opened this issue Dec 12, 2023 · 1 comment
Closed
1 task done

Comments

@faridmovsumov
Copy link

faridmovsumov commented Dec 12, 2023

Issue summary

I am getting the following error after running yarn dev command in the fresh installation.

ERROR  Cannot read properties of null (reading 'useContext')

node_modules/@shopify/app/node_modules/react/cjs/react.development.js:1618:21

1615:     }
1616:   }
1617:
1618:   return dispatcher.useContext(Context);
1619: }
1620: function useState(initialState) {
1621:   var dispatcher = resolveDispatcher();

- useContext (node_modules/@shopify/app/node_modules/react/cjs/react.development.js:1618:21)
- useStdin (node_modules/@shopify/app/node_modules/ink/build/hooks/use-stdin.js:6:24)
- Dev (node_modules/@shopify/app/dist/cli/services/dev/ui/components/Dev.js:13:53)
-renderWithHoo (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-reconc
 s            iler.development.js:7478:18)
-mountIndeterminateCom (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/reac
 onent                t-reconciler.development.js:11247:13)
-beginWor (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-reconciler.
         development.js:12760:16)
-beginWork$ (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-reconcile
           r.development.js:19569:14)
-performUnitOfW (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-recon
 rk            ciler.development.js:18703:12)
-workLoopSyn (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-reconcil
            er.development.js:18609:5)
-renderRootSy (node_modules/@shopify/cli-kit/node_modules/react-reconciler/cjs/react-reconci
 c           ler.development.js:18577:7)

image

When running npm run dev command additionally I am getting the following warnings.

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.

Expected behavior

React should run.

Actual behavior

Error explained in description thrown.

Steps to reproduce the problem

  1. I just followed the steps in readme.

Checklist

  • I have described this issue in a way that is actionable (if possible)
@faridmovsumov
Copy link
Author

Running the following command in the root directory solved the problem.

npm update
Maybe this information can be added in the readme.

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

1 participant