Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Requiring unknown module "undefined" on react-native-maps

I want to implement react-native-maps from here. But when I import MapView above on App.js with the code import MapView from 'react-native-maps'; I get this error:

Requiring unknown module "undefined".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 environement).

My package.json is

{
  "name": "MyNewProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "npm": "^5.8.0",
    "react": "16.3.0-rc.0",
    "react-native": "0.54.4",
    "react-native-image-picker": "^0.26.7",
    "react-native-maps": "^0.20.1"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.3",
    "react-test-renderer": "16.3.0-rc.0"
  },
  "jest": {
    "preset": "react-native"
  }
}
like image 920
Pooya Sabramooz Avatar asked Jan 28 '26 23:01

Pooya Sabramooz


1 Answers

Try changing this from your package.json "react-native-maps": "^0.20.1" into this "react-native-maps": "https://github.com/react-community/react-native-maps.git"` to ensure that you will use the master branch as suggested here https://github.com/react-community/react-native-maps/issues/2051#issuecomment-371530715

like image 147
MaieonBrix Avatar answered Jan 31 '26 17:01

MaieonBrix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!