Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

Solved

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

anxiouspenguin
Shopify Partner
10 2 1

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. 😞

 

Thank you,

Michael

Accepted Solution (1)
anxiouspenguin
Shopify Partner
10 2 1

This is an accepted solution.

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!

View solution in original post

Replies 3 (3)

Liam
Community Manager
3108 344 905

Hi Anxiouspenguin - are you still seeing this issue?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

anxiouspenguin
Shopify Partner
10 2 1

This is an accepted solution.

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!

Liam
Community Manager
3108 344 905

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

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog