npm run deploy ERROR Cannot read properties of null (reading 'useState')

Hi,

When I run npm run deploy, terminal responds with:

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

 node_modules/@shopify/cli-kit/node_modules/react/cjs/react.development.js:1622:21

 1619: }
 1620: function useState(initialState) {
 1621:   var dispatcher = resolveDispatcher();
 1622:   return dispatcher.useState(initialState);
 1623: }
 1624: function useReducer(reducer, initialArg, init) {
 1625:   var dispatcher = resolveDispatcher();

 - useState (node_modules/@shopify/cli-kit/node_modules/react/cjs/react.development.js:1622:21)
 - usePrompt (file:///Users/mlorig/GitHub%20Repos/ipp-shopify-checkout-app/node_modules/@shopify/cli-kit/dist/private/node/ui/hooks/use-prompt.js:11:43)
 -SelectPrompt (file:///Users/mlorig/GitHub%20Repos/ipp-shopify-checkout-app/node_modules/@shopify/cli-kit/dist/private/node/ui/components/SelectPrompt.js
              :12:64)
 - renderWithHooks (node_modules/react-reconciler/cjs/react-reconciler.development.js:6659:18)
 - mountIndeterminateComponent (node_modules/react-reconciler/cjs/react-reconciler.development.js:11276:13)
 - beginWork (node_modules/react-reconciler/cjs/react-reconciler.development.js:12799:16)
 - beginWork$1 (node_modules/react-reconciler/cjs/react-reconciler.development.js:19608:14)
 - performUnitOfWork (node_modules/react-reconciler/cjs/react-reconciler.development.js:18742:12)
 - workLoopSync (node_modules/react-reconciler/cjs/react-reconciler.development.js:18648:5)
 - renderRootSync (node_modules/react-reconciler/cjs/react-reconciler.development.js:18616:7)

My app deploy was working OK until last week. Since last Friday, I tried updating packages, deleting files, doing everything the internet told me to do, etc. but no luck. Running npm run dev works OK but shows a punycode deprecation. Please help. :disappointed_face:

Thank you,

Michael

Hi Anxiouspenguin - are you still seeing this issue?

Hey @Liam ,

I was finally able to resolve this after upgrading and using shopify app deploy instead of npm run deploy. I’m not sure what suddenly changes but gosh, that was crazy! This is my first Shopify app so it’s a new world for me as a theme developer.

Thank you!

Glad you figured this out - and thanks for posting your solution. Best of luck with the rest of your project!