ReactNative报错bundling failed: Error: Unable to resolve module `AccessibilityInfo`

最近根据RN中文网使用RN初始化一个项目时,会出现这个报错

使用react-native init Demo(项目名称)这个命令行时,得到的package.json里的依赖包版本是这样的

"dependencies": {
    "react": "16.4.1",
    "react-native": "0.56.0"
  },
"devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "5",
    "jest": "23.4.2",
    "react-test-renderer": "16.4.1"
  },

这个是最新的版本,但是是不稳定的

可以将package.json里的react和react-native改成如下版本,再输入命令行yarn install重新安装一下依赖包就可以了

"dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-navigation": "^2.10.0"
  },
  "devDependencies": {
    "babel-jest": "23.4.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.4.2",
    "react-test-renderer": "16.4.1"
  },

确定版本更改并安装了以后重新跑一下项目即可

react-native run-android
npm start

 

你可能感兴趣的:(React,Native)