问题开始在模拟器一个反应天然应用

时间:2019-02-02 20:18:46

标签: reactjs react-native

这是我的package.json

{
  "name": "Locals",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@babel/runtime": "^7.3.1",
    "react": "16.6.3",
    "react-native": "0.58.3",
    "react-native-elements": "^1.0.0",
    "react-native-vector-icons": "^6.2.0"
  },
  "devDependencies": {
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "24.0.0",
    "jest": "24.0.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.6.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

和我得到以下的故障日志:

  

已完成加载依赖关系图。错误:捆绑失败:错误:无法   找到模块“NativeModules”       在Function.Module._resolveFilename(内部/模块/cjs/loader.js:581:15)       在Function.Module._load(内部/模块/cjs/loader.js:507:25)       在Module.require(internal / modules / cjs / loader.js:637:17)       在要求时(内部/模块/cjs/helpers.js:20:18)       在Object.get NativeModules [作为NativeModules](/Users/vb05mj/Developer/personal/small-town/Locals/node_modules/react-native/Libraries/react-native/react-native-implementation.js:313:12)       在Object.get [按NativeModules](/Users/vb05mj/Developer/personal/small-town/Locals/node_modules/react-native-vector-icons/dist/lib/react-native.js:1:344)       在对象。 (/Users/vb05mj/Developer/personal/small-town/Locals/node_modules/react-native-vector-icons/dist/lib/ensure-native-module-available.js:1:238)       在Module._compile(internal / modules / cjs / loader.js:689:30)

1 个答案:

答案 0 :(得分:1)

运行MyRendererView.h以重新安装依赖项。

确保Vector.h已正确链接。通常,您应该在"terser": "3.14.1",中包含以下行:

rm -rf node_modules && npm install

更多信息在这里: https://github.com/oblador/react-native-vector-icons#android

杀死npm服务器(ctrl + c或仅运行react-native-vector-icons)并使用android/app/build.gradle

重新启动它

最后,不要忘记重建您的应用程序: apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"