找不到输入文件index.js

时间:2017-10-12 15:21:30

标签: react-native

我尝试使用https://github.com/evollu/react-native-fcm模块向我的应用添加推送通知。 我最终遇到了很多错误,并在节点上运行了许多反应命令,包括uprade命令。 现在在模拟器上红色屏幕上写着“无法找到任何根目录中的入口文件index.js”,当我看到ReactPackager它说:

Loading dependency graph, done. Bundlingindex.js[development, non-minified] 0.0% (0/1), failed. error: bundling failed: Error at DependencyGraph._getAbsolutePath (/Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11) at DependencyGraph.getDependencies (/Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236) at Resolver.getDependencies (/Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/Resolver/index.js:129:5) at /Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/Bundler/index.js:642:39 at Generator.next (<anonymous>) at step (/Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/Bundler/index.js:13:1336) at /Users/beratuslu/Desktop/react-native-starter-app/node_modules/metro-bundler/src/Bundler/index.js:13:1496 at process._tickCallback (internal/process/next_tick.js:103:7)

enter image description here

这是我的package.json:https://pastebin.com/2CsXCyJt

任何帮助表示赞赏...

2 个答案:

答案 0 :(得分:10)

从本机0.49.1开始,有一个重大变化,将index.android.js和index.ios.js合并到index.js中。 有关详细信息,请参阅Github

中的此问题

答案 1 :(得分:0)

您可以尝试以下步骤

  1. (in project directory) mkdir android/app/src/main/assets
  2. react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
  3. react-native run-android