zoukankan      html  css  js  c++  java
  • React-Native坑1:Invariant Violation:Application 项目名 has not been registered.

    React-Native坑1:Invariant Violation:Application 项目名 has not been registered.

    字数347 阅读1421 评论3

    前言

    在学习一门新技术的你也许有跟我一样的困惑,照着书上或者视频上的敲了。但是就是有各种问题没有出来自己想要的结果。我会将自己在这个过程中遇到的坑都记录下来,不一定全覆盖,但希望这些文章可以解决你的问题。

     

    错误提示

    Invariant Violation:Applicaction 项目名 has not been registered.This is either due to a require() error during initialization or failure to call AppRegistry.registerCommponent.


    这个错误的根本原因是根目录./index.ios.js中

    AppRegistry.registerComponent('项目名',() => ...);

    与./ios/项目名/appDelegate.m中的

    RCTRootView*rootView = [[RCTRootViewalloc]initWithBundleURL:jsCodeLocation

    moduleName:@"项目名" launchOptions:launchOptions];

    或是./android/app/src/main/java/com/项目名/MainActivity.java中的

    mReactRootView.startReactApplication(mReactInstanceManager, "项目名", null);

    没有保持一致,解决方法很简单。编辑成相同的参数即可。

    但是,还有一种情况!

    即 便你确保一致了但还是出现相同的错误提示,这又是怎么搞得呢?这个时候你可以检查一下你的命令行。有可能你同时在运行一个以上的程序,像我。如果你的 react-native在运行程序A而你打开了程序B,也会出现相同的问题。解决方法很简单,关掉命令行运行程序。ctrl+c,运行你想运行的程序。

  • 相关阅读:
    JSP简单练习-数组应用实例
    Android中的动画具体解释系列【4】——Activity之间切换动画
    php学习之道:WSDL具体解释(三)
    破解电信光猫(个人真实经验)
    POj 1879 Tempus et mobilius Time and motion (模拟+群)
    使用mysql-mmm实现MySQL高可用集群
    德克萨斯扑克_百度百科
    姜饼屋_百度百科
    阿根廷探戈----中英文对照
    波尔卡舞_百度百科
  • 原文地址:https://www.cnblogs.com/agang-php/p/5820805.html
Copyright © 2011-2022 走看看