'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 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sadrzadehsina