DMS-KH
DMS-KH

Reputation: 2787

Cound not connect to development server in react-native-navigation on mac

Issue Description

I clone React-native-navigation and directed to Example for running the app after npm install command was used.

Clone URL : https://github.com/wix/react-native-navigation

screen shot 2017-10-26 at 8 56 29 am

enter image description here

Environment

AppDelegate.m:

#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>

// **********************************************
// *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
// **********************************************
#import "RCCManager.h"

// IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install"
// with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1)

#import <React/RCTRootView.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;
#ifdef DEBUG
  //jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
   jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif


  // **********************************************
  // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP *****
  // **********************************************
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  self.window.backgroundColor = [UIColor whiteColor];
  [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];
  //self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  /*
  // original RN bootstrap - remove this part
  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"example"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  */

  return YES;
}

@end

Error log

Loading dependency graph...2017-10-26 11:15 node[1963] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-26 11:15 node[1963] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-10-26 11:15 node[1963] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1018:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1420:11)
Loading dependency graph...~

Upvotes: 1

Views: 681

Answers (2)

DMS-KH
DMS-KH

Reputation: 2787

The first step

  • Brew update
  • brew install watchman

If first step was failed try step two

  • brew install node
  • brew install watchman
  • brew link automake pcre
  • npm install -g react-native-cli
  • export ANDROID_HOME=~/Library/Android/sdk
  • export PATH=${PATH}:${ANDROID_HOME}
  • react-native run-android

Upvotes: 0

Cristopher E.
Cristopher E.

Reputation: 34

Normally as the error says the react native developer server is not running. by default it should open another terminal with the developer server for react native. sometimes it can hang in there you can just re-run react-native run-ios with in another terminal while the one you have is opened, if that doesnt try rm -rf ~/.rncache and deleting the ios build

Upvotes: 1

Related Questions