Unable to resolve module ../Utilities/Platform - Expo Web

198 views Asked by At

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

1

There are 1 answers

0
tamke001 On

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.

import NativeSafeAreaView from "react-native-safe-area-context/src/specs/NativeSafeAreaView";

After I removed this import and stopped using it in my code, the error message disappeared. Hope it will helps