我有一个使用npm start -- --reset-cache运行的React-Native应用程序。然后我运行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呢?
你知道我该怎么解决这个问题吗?
发布于 2017-10-10 22:01:51
在0.49.1版之后,index.android.js和index.ios.js文件合并为一个文件。https://github.com/facebook/react-native/issues/16208
我知道您将不得不升级旧版本中的应用程序。我猜这一过渡将是困难的。
https://stackoverflow.com/questions/46649280
复制相似问题