question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to resolve module ../../package.json

See original GitHub issue

Describe the bug

Hello! I am quite new to React Native and trying to integrate Stripe using @stripe/stripe-react-native. After initializing the library following the installment guide on Stripe (https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom), I get the error below and not sure how to solve this (I don’t know if this is a bug or not).

Unable to resolve module ../../package.json from /Users/.../node_modules/@stripe/stripe-react-native/lib/commonjs/components/StripeProvider.js: None of these files exist: *node_modules/@stripe/stripe-react-native/lib/package.json

Versions

react: 17.0.2
react-native: 0.66.4
stripe-react-native: 0.2.3
babel: 7.12.9
running device: iOS 15 simulator

Also I am developing in React cli (not expo)

Is there anything else I need to integrate the library other than yarn add and pod install ? Any help would be much appreciated! Thanks a lot in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
yanzdogcommented, Jan 27, 2022

@alekhinen @jukaha

I am using https://github.com/apollographql/apollo-client for api client and added some changes to metro config referring to this change log. (https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md#apollo-client-354-2021-11-19).

However, require("metro-config") was looking at wrong path and causing this stripe error. So I corrected it to the right path which is require('metro-config/src/defaults/defaults').

Hope this helps!

0reactions
Kinzito17commented, Mar 11, 2022

@jukaha @alekhinen I was able to find a workaround to this issue here hope it helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Resolve Module in React Native App - Stack Overflow
Unable to solve module 'module-name' is realated to the node modules packages and sometime you would need to ...
Read more >
Issues - GitHub
Already tried everything from #770 but no success. error: Error: Unable to resolve module ../../package.json from ...
Read more >
React Native, Typescript and VS Code: Unable to resolve ...
React Native, Typescript and VS Code: Unable to resolve module · Reset the tool that watches files for changes on disk: · Rebuild...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
Troubleshooting | React Navigation
If the module points to an npm package (i.e. the name of the module doesn't with ./ ), then it's probably due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found