When i try to run react-native project via expo I get this error

E:/reacrNative23april/firestoreTester26April/node_modules/react-native/Libraries/StyleSheet/processColor.js
Module not found: Can't resolve '../Utilities/Platform' in 'E:\reacrNative23april\firestoreTester26April\node_modules\react-native\Libraries\StyleSheet'

This seems to be a common issue (as apparent through a google search), but appears to be unsolved.

There is some buzz on this link https://github.com/expo/web-examples/issues/73, but the solution is not clear.

Has anyone experienced and resolved this?

More data-

  1. Mine is a bare workflow project, with some native modules, not sure if they can be the issue
  2. I have tried deleteing the node_modules folder and running npm install, but no luck
1

There are 1 best solutions below

2
On

There is no non-native (i.e. web) version of Utilities/Platform in react-native.

You can create a webpack.config.js (expo has a helper for this) and add an alias for the relative reference to Utilities/Platform used from within various rn libraries to the one provided by react-native-web:

const createExpoWebpackConfigAsync = require('@expo/webpack-config');

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(env, argv);
  // Customize the config before returning it.
  // Resolve relative reference ../Utilities/Platform using react-native-web
  config.resolve.alias['../Utilities/Platform'] = 'react-native-web/dist/exports/Platform';
  return config;
};