捆绑失败:运行React-Native项目

时间:2017-10-09 14:50:14

标签: android node.js react-native

我有一个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模拟器上?

有关如何解决此问题的任何想法吗?

1 个答案:

答案 0 :(得分:0)

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

据我所知,您必须升级旧版本的应用程序。我猜这种过渡很困难。