我正在尝试在模拟器上运行我的reactNative应用,但在Android模拟器中却遇到此错误

时间:2018-10-03 19:36:17

标签: android react-native android-emulator react-native-android

错误图片enter image description here

以下是错误消息

开发服务器返回响应错误代码:500

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

身体: {“ originModulePath”:“ / home / junior / ReactNative / HelloWorld / index.js”,“ targetModuleName”:“ @ babel / runtime / helpers / interopRequireDefault”,“消息”:“无法从以下位置解析模块@babel/runtime/helpers/interopRequireDefault /home/junior/ReactNative/HelloWorld/index.js:Haste模块映射中不存在模块@babel/runtime/helpers/interopRequireDefault \ n \ n这可能与https://github.com/facebook/react-native/issues/4968 \ n有关。要解决此问题,请尝试以下操作:\ n 1.清除值班员手表:{{ 1}}。\ n 2.删除watchman watch-del-all文件夹:node_modules。\ n 3.重置Metro Bundler缓存:rm -rf node_modules && npm installrm -rf /tmp/metro-bundler-cache-*。\ n 4.删除仓促缓存:npm start -- --reset-cache。“,”错误“:[{”描述“:”无法从rm -rf /tmp/haste-map-react-native-packager-*解析模块@babel/runtime/helpers/interopRequireDefault:急速模块中不存在模块/home/junior/ReactNative/HelloWorld/index.js地图\ n \ n这可能与https://github.com/facebook/react-native/issues/4968有关。\ n要解决此问题,请尝试以下操作:\ n 1.清除值班员监视:@babel/runtime/helpers/interopRequireDefault。\ n 2.删除watchman watch-del-all文件夹:{{ 1}}。\ n 3.重置Metro Bundler缓存:node_modulesrm -rf node_modules && npm install。\ n 4.删除急速缓存:rm -rf /tmp/metro-bundler-cache-*。“}],”名称“:”错误“ ,“堆栈”:“错误:无法解析npm start -- --reset-cache中的模块rm -rf /tmp/haste-map-react-native-packager-*:Haste模块映射中不存在模块@babel/runtime/helpers/interopRequireDefault \ n \ n这可能与{{3} } \ n要解决此问题,请尝试以下操作:\ n 1.清除看守手表:/home/junior/ReactNative/HelloWorld/index.js。\ n 2.删除@babel/runtime/helpers/interopRequireDefault文件夹:watchman watch-del-all。\ n 3.重置Metro Bundler缓存:node_modules或{{1} }。\ n 4.删除急速缓存:rm -rf node_modules && npm install。\ n位于ModuleResolver.resolveDependency(/home/junior/ReactNative/HelloWorld/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209: 1301)\ n在ResolutionRequest.resolveDependency(/home/junior/ReactNative/HelloWorld/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:83:16)\n在DependencyGraph.resolveDependency(/ home / junior / ReactNative / HelloWorld / node_modules / metro / src / node-haste / DependencyGraph.js:238:485)\ n在Object.resolve(/home/junior/ReactNative/HelloWorld/node_modules/metro/src/lib/transformHelpers.js: 180:25)\ n在dependents.map.result(/home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:311:29)\n在Array.map()\ n在resolveDependencies (/ home / junior / ReactNative / HelloWorld / node_modules / metro / src / DeltaBundler / traverseDepe ndencies.js:307:16)\ n在/home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:164:33\n在Generator.next()\ n在步骤(/ home /junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:266:307)“} processBundleResult     BundleDownloader.java:296 访问$ 200     BundleDownloader.java:37 onResponse     BundleDownloader.java:174 执行     RealCall.java:153 跑     命名为Runnable.java:32 runWorker     线程池执行器.java:1167 跑     线程池执行器.java:641 跑     Thread.java:764

1 个答案:

答案 0 :(得分:0)

从终端(在您的项目目录中)运行以下命令:

npm add @babel/runtime
npm install