error when open react native app in android device using expo

Viewed 88

I have this problem when I try to open my react-native app on my android device. the error I get in the console:

Unable to resolve module os from E:\frontend-master\react\project-3\node_modules\uniqid\index.js: os could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
   15 | var address = '';
   16 | if(typeof __webpack_require__ !== 'function' && typeof require !== 'undefined'){
>  17 |     var mac = '', os = require('os'); 
      |                                 ^
   18 |     if(os.networkInterfaces) var networkInterfaces = os.networkInterfaces();
   19 |     if(networkInterfaces){
   20 |         loop:
Building JavaScript bundle: error

my app.json:

{
  "expo": {
    "name": "project-3",
    "slug": "project-3",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      }
    },
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~42.0.1",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-web": "~0.13.12",
    "uniqid": "^5.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0"
  },
  "private": true
}

this is the error I get on the phone: enter image description here

when I try to open the app in the browser is it work fine so I don't know what is the problem please let me know if you need any additional code. thanks

0 Answers
Related