捆绑失败:运行React-Native项目时出现错误和404错误

我有一个React-Native应用程序,我正在使用npm start -- --reset-cache 。 然后运行react-native run-android

但是,我在npm服务器的控制台中遇到这个问题:

 Bundling `index.js` [development, non-minified] 0.0% (0/1), failed. error: bundling failed: Error at DependencyGraph._getAbsolutePath (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11) at DependencyGraph.getDependencies (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236) at Resolver.getDependencies (/myProjectPath/node_modules/metro-bundler/src/Resolver/index.js:129:5) at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:642:39 at Generator.next (<anonymous>) at step (/myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1336) at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1496 at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) 

然后,在Android模拟器中,我得到:

 The development server returned response error code: 404 URL: http//10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false Body: {"message": "Cannot find entry file index.js in any of the roots" 

这使我困惑。 为什么它寻找index.js而不是index.android.js ,因为我在Android模拟器上?

任何关于如何解决这个问题的想法?

在版本0.49.1之后,index.android.js和index.ios.js文件合并成一个文件。 https://github.com/facebook/react-native/issues/16208

我知道你将不得不升级在旧版本的应用程序,我想这个过渡将是困难的。