Expo web build failed due to "Cannot find module: './RCTNetworking' "

I was trying to enable web support of my app. But i got this error:

Failed to compile.

./node_modules/react-native/Libraries/Network/XMLHttpRequest.js
Cannot find module: './RCTNetworking'. Make sure this package is installed.

You can install this package by running: yarn add ./RCTNetworking.

All of my project facing this problem. Can anyone help me? this is my package.json

{
  "scripts": {
    "start": "expo start --dev-client",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.0",
    "@react-native-async-storage/async-storage": "^1.13.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/datetimepicker": "3.5.2",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-segmented-control/segmented-control": "2.3.0",
    "@react-navigation/bottom-tabs": "^6.0.0-next.22",
    "@react-navigation/drawer": "^6.0.0-next.21",
    "@react-navigation/elements": "^1.0.0-next.21",
    "@react-navigation/material-top-tabs": "^6.0.0-next.18",
    "@react-navigation/native": "^6.0.0-next.17",
    "@react-navigation/stack": "^6.0.0-next.29",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "axios": "^0.21.1",
    "crypto-js": "^3.3.0",
    "expo": "~42.0.0",
    "expo-apple-authentication": "~3.2.1",
    "expo-barcode-scanner": "~10.2.2",
    "expo-camera": "~11.2.1",
    "expo-dev-client": "^0.4.3",
    "expo-device": "~3.3.0",
    "expo-font": "~9.2.1",
    "expo-image-picker": "~10.2.2",
    "expo-linear-gradient": "~9.2.0",
    "expo-localization": "~10.2.0",
    "expo-sensors": "~10.2.2",
    "expo-splash-screen": "~0.11.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.8.0",
    "i18next": "^20.2.1",
    "moment": "^2.29.1",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-i18next": "^11.8.12",
    "react-native": "~0.63.4",
    "react-native-collapsible-tab-view": "^4.1.0",
    "react-native-fast-image": "^8.3.5",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-image-viewing": "^0.2.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-maps": "0.28.0",
    "react-native-modal-datetime-picker": "^9.2.0",
    "react-native-modalize": "^2.0.8",
    "react-native-network-logger": "^1.8.1",
    "react-native-pager-view": "^5.2.1",
    "react-native-paper": "^4.8.1",
    "react-native-reanimated": "^2.0.0",
    "react-native-render-html": "^5.1.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "~3.4.0",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^3.0.1",
    "react-native-toast-hybrid": "^2.4.0",
    "react-native-unimodules": "~0.14.3",
    "react-native-web": "~0.13.12",
    "react-native-webview": "11.6.2"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@types/react": "~16.9.35",
    "@types/react-native": "~0.63.2",
    "prettier": "^2.3.2",
    "typescript": "~4.0.0"
  },
  "private": true,
  "name": "",
  "version": "1.0.0"
}

Looks the same as Failed to compile - Can't resolve './RCTNetworking' - #7 by woodjme

Yes! The error messages are the same! But i have never used reactotron or something. There are no such characters within my project… I encountered this problem on both my expo projects

I finally solved this problem by myself. For anyone who facing this problem too, check these steps:

  • This kind of problem is usually caused by some third-party library that doesn’t support react-native-web
  • Check every library that contains networking things. For me, i removed the react-native-network-logger library from my project. The problem solved!
1 Like

Thanks for sharing your insights with the community, @likeso!