【问题标题】:Requiring unknown module "undefined" on react-native-maps在 react-native-maps 上需要未知模块“未定义”
【发布时间】:2018-09-10 08:15:18
【问题描述】:

我想从here 实现 react-native-maps。 但是当我在App.js 上使用代码import MapView from 'react-native-maps'; 导入上面的 MapView 时,我得到了这个错误:

需要未知模块“未定义”。如果您确定该模块存在,请尝试重新启动 Metro Bundler。您可能还想运行yarnnpm install(取决于您的环境)。

我的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"
  }
}

【问题讨论】:

标签: ios reactjs react-native react-native-maps


【解决方案1】:

尝试将您的 package.json "react-native-maps": "^0.20.1" 更改为“react-native-maps”:“https://github.com/react-community/react-native-maps.git”`,以确保您将按照此处的建议使用主分支 https://github.com/react-community/react-native-maps/issues/2051#issuecomment-371530715

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-09
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多