在 react-native-maps 上需要未知模块 "undefined"

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

我想从 here 实现 react-native-maps。 但是,当我在 App.js 上使用代码 import MapView from 'react-native-maps'; 导入 MapView 时,出现此错误:

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).

我的package.json

{
  "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"
  }
}

尝试将此从您的 package.json "react-native-maps": "^0.20.1" 更改为此 "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