Search code examples
reactjsstripe-payments

Stripe API: Module not found: Can't resolve '@stripe/react-stripe.js'


Do I have a simple typo? Do I need to install anything else? I'm getting the following error message:

"Module not found: Can't resolve '@stripe/react-stripe.js'"

I have also npm installed: @stripe/react-stripe-js @stripe/stripe-js

Appreciate any help figuring this out!

Below are screenshots for reference: enter image description here

enter image description here


Solution

  • import ... from '@stripe/react-stripe-js'
    

    You are importing it in the wrong way. @stripe/react-stripe.js is not correct. Just replace . with -, it should work then.

    As you can see in the its document. You need to import its component from @stripe/react-stripe-js

    stripe-js correct import statement