在react-Native中编译代码时出错

时间:2017-09-12 09:55:56

标签: react-native

您好我在通过命令编译代码时收到错误,但是使用Android Studio运行代码。显示错误消息

bundling: UnableToResolveError: Unable to resolve module `react-native/Libraries/Renderer/shims/ReactNativePropRegistry` from `/home/rahul/React/Android /trixie/trixie/node_modules/native-base/dist/src/Utils/computeProps.js`: Module does not exist in the module map or in these directories:
  /home/rahul/React/Android /trixie/trixie/node_modules/native-base/node_modules/react-native/Libraries/Renderer/shims
,   /home/rahul/React/Android /trixie/trixie/node_modules/react-native/Libraries/Renderer/shims
,   /home/rahul/React/node_modules/react-native/Libraries/Renderer/shims

我的Package.JSON是我在项目中使用并获得上述错误消息

     "dependencies": {
     "@ptomasroos/react-native-multi-slider": "0.0.8",
     "axios": "^0.16.2",
     "native-base": "^2.3.1",
     "react": "16.0.0-alpha.12",
     "react-addons-update": "^15.6.0",
      "react-native": "^0.46.0",
     "react-native-checkbox": "^1.1.0",
      "react-native-cookie": "^0.1.1",
     "react-native-customisable-switch": "^0.1.0",
     "react-native-elements": "^0.14.0",
     "react-native-fbsdk": "^0.6.1",
     "react-native-geocoder": "^0.4.8",
     "react-native-google-places": "^2.4.1",
     "react-native-google-places-autocomplete": "^1.2.12",
     "react-native-image-picker": "^0.26.3",
     "react-native-instagram-login": "^1.0.2",
     "react-native-instagram-oauth": "0.0.7",
     "react-native-looped-carousel": "^0.1.7",
     "react-native-maps": "^0.15.3",
     "react-native-modal": "^2.4.0",
     "react-native-permissions": "^1.0.0",
     "react-native-router-flux": "^4.0.0-beta.17",
     "react-native-slider": "^0.10.0",
     "react-native-vector-icons": "^4.2.0",
     "react-native-xmpp": "^0.5.0",
     "react-navigation": "^1.0.0-beta.11",
     "react-redux": "^5.0.5",
      "redux": "^3.7.1",
      "redux-logger": "^3.0.6",
     "redux-thunk": "^2.2.0",
     "superagent": "^3.5.2"
      },
      "devDependencies": {
     "babel-jest": "20.0.3",
     "babel-preset-react-native": "2.0.0",
     "eslint-config-rallycoding": "^3.2.0",
     "jest": "20.0.4",
     "react-test-renderer": "16.0.0-alpha.12"
   },
      }

2 个答案:

答案 0 :(得分:1)

我认为你的node_modules有问题,基本上它告诉你ReactNativePropRegistry不存在,试着用这个删除node_modules:

rm -rf node_modules/
npm install

如果您可以向我们展示您的代码,那么其他人就会更容易知道问题是什么

答案 1 :(得分:0)

我认为这是本地反应和原生基地的版本问题。

请检查以下本机问题。

https://github.com/GeekyAnts/NativeBase/issues/1029