我正在尝试运行react-native应用程序,但是在构建成功后,终端会说这样的事情
成功构建
Total time: 9.967 secs
Running c:\Users\adity\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (c:\Users\adity\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 shell
am start -n com.awesomeproject/com.awesomeproject.MainActivity)...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
Done in 15.61s.
在模拟器中说
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":"C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\react-native\\Libraries\\react-native\\react-native-implementation.js","targetModuleName":"AccessibilityInfo","message":"Unable to resolve module `AccessibilityInfo` from `C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\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 `C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\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 `C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\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 (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:167:1306)\n at ResolutionRequest.resolveDependency (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:80:16)\n at DependencyGraph.resolveDependency (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:237:485)\n at Object.resolve (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\lib\\transformHelpers.js:116:25)\n at dependencies.map.result (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:298:29)\n at Array.map (<anonymous>)\n at resolveDependencies (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:294:16)\n at C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:159:33\n at Generator.next (<anonymous>)\n at step (C:\\Users\\adity\\Desktop\\react-native\\awesomeproject\\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:1162
run
ThreadPoolExecutor.java:636
run
Thread.java:764
有什么办法可以解决这个问题?
答案 0 :(得分:0)
react-native在0.56中被破坏。 降级到0.55.4
在创建具有0.56的项目后,降级到0.55.4。