Solved

[Checkout Extensions] ERROR: Could not resolve modules

dbiggiogero
Shopify Partner
5 1 2

Hello,

I followed the steps written there: https://shopify.dev/docs/apps/getting-started/create

I generated an extension and got the `shopify.app.toml` updated.

When I launch `npm run dev`, the script crashes giving me those errors:

Error: Build failed with 2 errors:
    extensions/privacy-checkbox/src/Checkout.jsx:6:7: ERROR: Could not resolve "@shopify/ui-extensions-react/checkout"
    extensions/privacy-checkbox/src/Checkout.jsx:10:8: ERROR: Could not resolve "react/jsx-runtime"

Note that I didn't make any change to the code generated by `init @Shopify/app@latest` and `generate extension`.
I checked that the packages are installed and I see those 2 modules correctly installed.
Already tried to delete node_modules and package-lock.json, clean cache and update packages without success.

I'm also surprised that a vanilla extension is not working out of the box. What can I do?

Node: v20.10.0
npm: 10.40.0

Accepted Solution (1)

dbiggiogero
Shopify Partner
5 1 2

This is an accepted solution.

Seems like I got it working: there was a .pnp.cjs file on the root folder on my pc, totally outside the project folder, that somehow it's interfering with the build process of `shopify app dev`.

I deleted the file and the errors are gone.

View solution in original post

Replies 3 (3)

dbiggiogero
Shopify Partner
5 1 2

I also tried with pnpm, same procedure:

- create @Shopify/app,

- go into the generated folder

- pnpm generate extension
in all those steps I didn't encounter any error, I successfully linked my app to an existing one on my partner account.

but I get the same error on `pnpm dev`, same modules not found

dbiggiogero
Shopify Partner
5 1 2

used node 18.16.0 with npm 9.8.1 and got same errors

dbiggiogero
Shopify Partner
5 1 2

This is an accepted solution.

Seems like I got it working: there was a .pnp.cjs file on the root folder on my pc, totally outside the project folder, that somehow it's interfering with the build process of `shopify app dev`.

I deleted the file and the errors are gone.