Unable to build and deploy apps

I am trying to build this example: https://shopify.dev/docs/apps/checkout/product-offers/pre-purchase/getting-started

I created an app and added the checkout extensions too.

When I try npm run build and npm run deploy, I get this error for both the commands.

TypeError: Cannot read property 'isBatchingLegacy' of undefined
    at ensureRootIsScheduled (/Users/admin/dev-products/extensions-test-3/node_modules/react-reconciler/cjs/react-reconciler.development.js:17731:35)
    at scheduleUpdateOnFiber (/Users/admin/dev-products/extensions-test-3/node_modules/react-reconciler/cjs/react-reconciler.development.js:17636:5)
    at Object.updateContainer (/Users/admin/dev-products/extensions-test-3/node_modules/react-reconciler/cjs/react-reconciler.development.js:21022:5)
    at Ink.unmount (file:///Users/admin/dev-products/extensions-test-3/node_modules/ink/build/ink.js:262:20)
    at EventEmitter.emit (events.js:412:35)
    at EventEmitter.emit (domain.js:475:12)
    at emit (/Users/admin/dev-products/extensions-test-3/node_modules/signal-exit/index.js:105:13)
    at processEmit [as emit] (/Users/admin/dev-products/extensions-test-3/node_modules/signal-exit/index.js:193:7)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! extensions-test-3@1.0.0 build: `shopify app build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the extensions-test-3@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

So, I tried running shopify app build and shopify app deploy. Then I get this error.

Command 'app build' not found.   

Command `app deploy` not found. Did you mean `theme dev`?

My app dependencies are these:

"dependencies": {
    "@shopify/app": "3.45.1",
    "@shopify/checkout-ui-extensions-react": "^0.24.0",
    "@shopify/cli": "3.45.1",
    "react": "^17.0.2"
  }

How do I build and deploy this app now?

This error was appearing when attempting to make new app with shopify-cli at the “npm run dev” step.

In my case npm and package updates solved the issue.

npm update command:

npm install -g npm

Then from within your app directory update packages.

npm update

After updating npm and packages the “npm run dev” completed successfully.

3 Likes

Thank you B2tech. This worked!