Rifat Murtuza
Rifat Murtuza

Reputation: 119

react-native Error: Unable to resolve module `AccessibilityInfo`

I'm new in React-native I have followed all the instruction when I try to build my first app I got this error . I have clear catch restart npm but still got this error.

The development server returned response error code: 500

URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false

Body:
{"originModulePath":"F:\\React Native\\AttendenceSystem\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js","targetModuleName":"AccessibilityInfo","message":"Unable to resolve module `AccessibilityInfo` from `F:\\React Native\\AttendenceSystem\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.","errors":[{"description":"Unable to resolve module `AccessibilityInfo` from `F:\\React Native\\AttendenceSystem\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`."}],"name":"Error","stack":"Error: Unable to resolve module `AccessibilityInfo` from `F:\\React Native\\AttendenceSystem\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n  1. Clear watchman watches: `watchman watch-del-all`.\n  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.\n    at ModuleResolver.resolveDependency (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:167:1306)\n    at ResolutionRequest.resolveDependency (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:80:16)\n    at DependencyGraph.resolveDependency (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:237:485)\n    at Object.resolve (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\lib\\transformHelpers.js:116:25)\n    at dependencies.map.result (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:298:29)\n    at Array.map (<anonymous>)\n    at resolveDependencies (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:294:16)\n    at F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:159:33\n    at Generator.next (<anonymous>)\n    at step (F:\\React Native\\AttendenceSystem\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:239:307)"}
processBundleResult
    BundleDownloader.java:285
access$200
    BundleDownloader.java:37
onResponse
    BundleDownloader.java:163
execute
    RealCall.java:153
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1113
run
    ThreadPoolExecutor.java:588
run
    Thread.java:818

Upvotes: 3

Views: 7382

Answers (4)

Pheng Sengvuthy
Pheng Sengvuthy

Reputation: 260

That error is because of your react native project version.

You have to create your project like this by this version for now --->

react-native init ProjectName --version 0.55.4

Just wait for next version of React Native to let them fix that problem.

Upvotes: 7

milkersarac
milkersarac

Reputation: 3479

I assume you are using Windows. I got the same error lately and when I searched for it on github issues of react native, saw that people changed their package.json file. What works for my case is below, you can adapt it to your needs;

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4"
  },
  "devDependencies": {
    "babel-jest": "22.4.4",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.4",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

Do not forget to delete your node_modules folder first, then change your package.json similar to above, then finally run npm install.

Upvotes: 0

user8169074
user8169074

Reputation:

Seems like downgrading react-native version will fix the issue. Are you using the latest 0.56.1? New releases are pretty unstable especially if you are running Windows.

Downgrading to 0.55.4 should fix your problem: npm install [email protected]

You can take a look at this very similar issue: https://github.com/facebook/react-native/issues/14209

Upvotes: 0

Anwar Gul
Anwar Gul

Reputation: 683

See dependencies & devDependencies your package.json file if your find react native version 0.56 like this ---->

 "react-native":"0.56.0" 

in dependencies then change it to

"react-native":"0.55.4"

and in devDependencies change

"babel-preset-react-native": "5",

to

"babel-preset-react-native": "4.0.0",

and finally run

npm install

Upvotes: 4

Related Questions