'Requiring unknown module "11" error on iOS simulator

When I run the react native project with react-native run-ios.It shows the following error on my iOS simulator.On my android simulator, it is totally ok.I have deleted node module and reinstalled.But the error is still there.I don't want to entirely delete my ios/build folder since I have manually added library dependencies in there and that third party libraries were working properly in my react native project.Can someone help me with this?

Error Message

Requiring unknown module "11".If you are sure the module is there, try restarting Metro Bundler.You may also want to run yarn or npm install( depending on your environment ).

Error Message on iOS

package.json

{
  "name": "AwwsomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-navigation": "^1.1.473",
    "react-native-vector-icons": "^4.6.0"
  },
  "devDependencies": {
    "babel-jest": "23.2.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.2.0",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}


Solution 1:[1]

Restarting packager fixed my issue.

Solution 2:[2]

I fixed the issue with the instructions from the following page:

https://facebook.github.io/react-native/docs/troubleshooting#content

Basically it asks you to terminate the processes running on a specific port.

Run the following command to find the id for the process that is listening on port 8081:

$ sudo lsof -i :8081

Then run the following to terminate the process:

$ kill -9 <PID> 

Solution 3:[3]

I just killed all node processes

killall node

? and launched again

Solution 4:[4]

I had the same problem. Running npm install or yarn install should fix the issue.

Solution 5:[5]

I had the same problem while working with my react native app and expo. Same screen with 'Requiring Unknown Module 1".

This is how I fixed it:

  • I closed Expo
  • I closed the Metro bundler on my local host
  • I closed the packager on my terminal with Ctlr + C
  • I restarted with npm start
  • I relaunched the project on Expo.

It worked for me.

Solution 6:[6]

I had this issue on Android (React-Native-CLI). Terminating the application and restarting metro server absolutely solved the issue.

yarn react-native start

Solution 7:[7]

Using yarn, I did the following (for Android emulation):

From root directory in your project:

  1. cd android
  2. ./gradlew clean
  3. cd ..
  4. yarn start --reset-cache
  5. yarn android

Solution 8:[8]

  • Looks like node and the application inside simulator hangs sometimes. I encountered this several times on macOS / iOS.
  • yarn install did not help.
  • restarting simulation with expo run:ios / yarn start / yarn ios did not help.
  • What helped was killall node and killall <your_mobile_app_name>.

Solution 9:[9]

npm run ios fixed for me after npm start

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mert Doe
Solution 2 Yun Li
Solution 3 Anton Liannoi
Solution 4 Nuno Martins
Solution 5 Enora
Solution 6 Jin Long
Solution 7 Shn_Android_Dev
Solution 8 CeDeROM
Solution 9 Akshay Vijay Jain