Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo Web Server Error None of these files exist: node_modules/react-native/Libraries/Utilities/Platform(...) #1802

Open
OmerKayaa opened this issue Dec 25, 2024 · 1 comment

Comments

@OmerKayaa
Copy link

OmerKayaa commented Dec 25, 2024

Describe the bug
When adding the following line to my code:

const { confirmPayment } = useConfirmPayment();

or

initStripe({publishableKey:"..."})

the web server (and only the web server) throws the following error:

Syntax Error  
None of these files exist:  
  * node_modules/react-native/Libraries/Utilities/Platform(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)  
  * node_modules/react-native/Libraries/Utilities/Platform  
Source  

26 | const Platform = require('../../Utilities/Platform');     
   |                           ^  

This issue occurs only in the web environment (Expo web). Mobile builds work as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following line to a page:
    const { confirmPayment } = useConfirmPayment();
  2. Run the command: npx expo start.
  3. Open the app in the web browser (http://localhost:8081).
  4. Observe the error.

Expected Behavior
The web server should serve the website without throwing an error.

Screenshots
Screenshot

Environment

  • npm: 9.6.7
  • tsc: 5.5.4
  • expo-cli: 6.3.10
  • Node.js: 21.7.3

Other Dependencies
Key dependencies:

{
  "@stripe/stripe-react-native": "^0.41.0",
  "expo": "~52.0.18",
  "expo-router": "~4.0.11",
  "react": "^18.3.1",
  "react-native": "^0.76.5",
  "react-native-web": "~0.19.10"
}

The full package.json

Additional Context
My project uses Expo Router, and the entry point is as follows:

<View style={styles.container}>
	{/* Logo */}
	<Animated.View style={[styles.logoContainer, { opacity: fadeAnim }]}>
		<Image source={require('...')} style={styles.logo} resizeMode='contain' />
	</Animated.View>
	{/* Onboarding Screens */}
	{isFirstLaunch && <OnboardingComponent fadeValue={onboardingFade} />}
</View>

The app is not wrapped with <StripeProvider> at the root due to Expo Router's limitations. Instead, specific pages are wrapped where needed, which works for mobile builds.

Question
Is this a bug in @stripe/stripe-react-native, or am I missing a configuration for Expo Web?

@zarkadoulasa
Copy link

zarkadoulasa commented Dec 29, 2024

I am having the same issue but when trying to create a web build with npx expo export -p web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants