I'm trying to run my expo react native app in web, but i'm getting this error:
Unable to resolve module ../Utilities/Platform from C:app\frontend\frontend\node_modules\react-native\Libraries\ReactNative\PaperUIManager.js:
None of these files exist:
- node_modules\react-native\Libraries\Utilities\Platform(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs)
- node_modules\react-native\Libraries\Utilities\Platform\index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) 15 | const NativeModules = require('../BatchedBridge/NativeModules'); 16 | const defineLazyObjectProperty = require('../Utilities/defineLazyObjectProperty');
17 | const Platform = require('../Utilities/Platform'); | ^ 18 | const UIManagerProperties = require('./UIManagerProperties'); 19 | 20 | const viewManagerConfigs: {[string]: any | null} = {};
Call Stack MetroBundlerDevServer.getStaticResourcesAsync (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js) process.processTicksAndRejections (node:internal/process/task_queues) async MetroBundlerDevServer.getStaticPageAsync (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js) async (node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js)
i have already defined a webpack.config.js and added config.resolve.alias['../Utilities/Platform'] = 'react-native-web/dist/exports/Platform';
tried to check find the package in the modules and solve the problem but wasnt a sucess, tried to create the webpack config using expo customize:web but nothing changed
I had the same problem today. I checked out my git repository step by step and found an import that was causing the issue for me.
After I removed this import and stopped using it in my code, the error message disappeared. Hope it will helps