我正在尝试建立一个简单的React Native应用并使用Reative Native Navigation v2运行,并遇到问题。
我的步骤非常简单且可重复(现在我已经尝试了三次),所以我一定会缺少一些东西,但是对于我一生来说,我不知道那是什么。
我遵循了React Native - Getting Started“使用本机代码构建项目”说明的MacOS / iOS版本,并按预期启动了应用程序。然后,我浏览了Installing - React Native Navigation v2的iOS部分。然后,当我运行时:
$ react-native run-ios
(不更改应用程序中的任何源文件)Metro Bundler启动(就像应用程序运行时一样),但现在会引发此讨厌的错误
Metro Bundler ready.
Loading dependency graph, done.
(node:19701) UnhandledPromiseRejectionWarning: Error: File not found: index.ios.js in any of the project roots (/Users/zposten/dev/moxie)
at getAbsolutePath (/Users/zposten/dev/moxie/node_modules/metro/src/lib/getAbsolutePath.js:32:9)
at Server._getOptionsFromUrl (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:1056:31)
at Server._prepareDeltaBundler (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:642:26)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:761:15
at Generator.next (<anonymous>)
at step (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:1077)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:1307
at new Promise (<anonymous>)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:988
at Server._processBundleRequest (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:839:32)
(node:19701) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:19701) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:19701) UnhandledPromiseRejectionWarning: Error: File not found: index.ios.js in any of the project roots (/Users/zposten/dev/moxie)
at getAbsolutePath (/Users/zposten/dev/moxie/node_modules/metro/src/lib/getAbsolutePath.js:32:9)
at Server._getOptionsFromUrl (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:1056:31)
at Server._prepareDeltaBundler (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:642:26)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:761:15
at Generator.next (<anonymous>)
at step (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:1077)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:1307
at new Promise (<anonymous>)
at /Users/zposten/dev/moxie/node_modules/metro/src/Server.js:11:988
at Server._processBundleRequest (/Users/zposten/dev/moxie/node_modules/metro/src/Server.js:839:32)
(node:19701) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
我第一次使用Create React Native,然后“弹出”应用程序,结果相同。
在这条路线上,我一直在质疑是否做错了什么的唯一文章是Installing - React Native Navigation v2指令中关于编辑AppDelegate.m
文件的那一部分。我从字面上看了“其内容应如下所示”下面的代码块,然后将其复制粘贴到文件中。第一次执行此操作时出现一个错误,但我遵循these instructions,一切都成功构建。
错误表明File not found: index.ios.js
,这是准确的。我似乎没有其中之一,但是React Native Navigation v2 Playground似乎都没有,而且我已经成功运行了此程序。
如果有帮助的话,我会在stack-overflow
branch on github上发布“应用程序”(它会在我遵循installing v2 instructions的最终提交中中断)。
有什么主意我做错了吗?预先谢谢你!