hyva-themes / magento2-checkout-example

A React Checkout template that allows you to quickly create a customized Hyvä Checkout for your project.
11 stars 2 forks source link

Having troubles with `npm install` and @hyva/react-checkout imports #23

Closed umizoomi closed 2 years ago

umizoomi commented 2 years ago

Hey ya'll,

When settings up this repo as explained in the docs, i'm running against the following issues:

  1. npm install complains about not being able to install from ../../../../../vendor/hyva-themes/magento2-react-checkout/src/reactapp/src because it contains no package.json When removing the last /src part, it works. But i'm wondering whether im missing something here.

  2. compilation fails because the module @hyva/react-checkout.... cannot be found:

Failed to compile.

Module not found: Error: Can't resolve '@hyva/react-checkout/src/utils/rootElement' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'
ERROR in ./src/index.jsx 7:0-69
Module not found: Error: Can't resolve '@hyva/react-checkout/src/utils/rootElement' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

ERROR in ./src/index.jsx 8:0-76
Module not found: Error: Can't resolve '@hyva/react-checkout/src/components/CheckoutForm' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

ERROR in ./src/index.jsx 9:0-83
Module not found: Error: Can't resolve '@hyva/react-checkout/src/context/Form/Step/StepProvider' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

ERROR in ./src/index.jsx 10:0-83
Module not found: Error: Can't resolve '@hyva/react-checkout/src/context/App/AppDataProvider' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

ERROR in ./src/index.jsx 11:0-86
Module not found: Error: Can't resolve '@hyva/react-checkout/src/context/Cart/CartDataProvider' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

ERROR in ./src/index.jsx 12:0-94
Module not found: Error: Can't resolve '@hyva/react-checkout/src/context/Form/CheckoutFormProvider' in '/Users/mcjambi/repos/magento2/app/code/Hyva/CheckoutExample/reactapp/src'

webpack compiled with 6 errors

I was hoping anyone can point me into the right direction, before i spent more time diving into these issues

umizoomi commented 2 years ago

Also, i'm using node v14.18.2 & npm 6.14.15 and got the default magento2-checkout composer package working (on the develop branch tho)

wigman commented 2 years ago

Hi @umizoomi, the node and npm versions are indeed relevant here. Please upgrade them to 16 / 8.

See https://github.com/hyva-themes/magento2-checkout-example/issues/20

umizoomi commented 2 years ago

thanks @wigman, that was it!