Unable to resolve module ../Utilities/Platform - Expo Web
Asked Answered
P

1

6

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

Potemkin answered 17/11, 2023 at 12:47 Comment(4)
Have you managed to solve it?Foveola
Any update? I am facing the same issueAdviser
Same issue here, it seems that there is only ../Utilities/Platform.ios.js in the given locationLocal
Could you please include package.json?Sclerenchyma
W
0

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

Wood answered 28/3 at 20:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.