question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[0.49.1] Broken bundling on run-ios in simulator

See original GitHub issue

Is this a bug report?

Yes.

Upgraded RN to 0.49.1.

Terminal output after react-native run-ios:

React packager ready.

Loading dependency graph, done.
Launching Dev Tools...
Bundling `index.js`  [development, non-minified]  0.0% (0/1), failed.
error: bundling failed: Error
    at DependencyGraph._getAbsolutePath ([PROJECT]/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11)
    at DependencyGraph.getDependencies ([PROJECT]/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236)
    at Resolver.getDependencies ([PROJECT]/node_modules/metro-bundler/src/Resolver/index.js:129:5)
    at [PROJECT]/node_modules/metro-bundler/src/Bundler/index.js:642:39
    at Generator.next (<anonymous>)
    at step ([PROJECT]/node_modules/metro-bundler/src/Bundler/index.js:13:1336)
    at [PROJECT]/node_modules/metro-bundler/src/Bundler/index.js:13:1496
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

And a corresponding redbox on simulator, for “Cannot find entry file index.js in any of the roots”. Reloading simulator would just repeat the above.

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.6.0 Yarn: 1.1.0 npm: 5.3.0 Watchman: 4.9.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: Not Found

Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.1 => 0.49.1

Target Platform: iOS (11.0)

Steps to Reproduce

  1. react-native-git-upgrade
  2. react-native run-ios
  3. Bundling failure, as shown above

Expected Behavior

App bundles and run.

Actual Behavior

screenshot 2017-10-04 17 08 46

Also in case it’s 3rd package issues (unlikely since it’s not building at all), here’s my package.json:

{
  "name": "[NAME]",
  "version": "0.0.1",
  "private": true,
  "eslintConfig": {
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
      }
    },
    "env": {
      "browser": true,
      "node": true
    },
    "plugins": [
      "react",
      "react-native"
    ],
    "rules": {
      "comma-dangle": [
        2,
        "always-multiline"
      ],
      "semi": [
        2,
        "never"
      ],
      "react-native/no-unused-styles": 2,
      "react-native/split-platform-components": 2
    }
  },
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "babel-plugin-idx": "^2",
    "he": "^1.1.0",
    "jssha": "^2.3.1",
    "lodash": "^4.17.2",
    "moment-timezone": "^0.5.10",
    "node-summary": "file:../node-summary",
    "react": "16.0.0-beta.5",
    "react-native": "0.49.1",
    "react-native-blur": "^3.1",
    "react-native-code-push": "5.1.3-beta",
    "react-native-firebase": "^3.0",
    "react-native-fit-image": "^1.4.8",
    "react-native-highlight-words": "^1.0.0",
    "react-native-keep-awake": "^2.0.4",
    "react-native-linear-gradient": "^2.0.0",
    "react-native-modalbox": "^1.3.8",
    "react-native-notification": "^2.0.0",
    "react-native-orientation": "^3.0.0",
    "react-native-parallax-scroll-view": "file:../react-native-parallax-scroll-view",
    "react-native-safari-view": "^2.0.0",
    "react-native-sentry": "^0.26",
    "react-native-status-bar-size": "^0.3.2",
    "react-native-swiper": "^1.5.10",
    "react-native-tooltip": "^5.0.0",
    "react-native-tts": "^1.3.0",
    "react-native-vector-icons": "^4.1.1",
    "react-native-webview-bridge": "lefnire/react-native-webview-bridge",
    "react-redux": "^5.0.1",
    "redux": "^3.6.0",
    "redux-thunk": "^2.1.0"
  },
  "devDependencies": {
    "redux-logger": "^3.0.6"
  }
}

Reproducible Demo

Umm, am I the only one hitting this after all the RC’s? I see some errors reported like this that’s caused by 3rd party packages, but my terminal output says nothing about errring on a certain package, it just ends on line at process._tickCallback (internal/process/next_tick.js:188:7).

I would give more reproducing details if I even know where to look.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:18
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

10reactions
Andreycocommented, Oct 5, 2017

Patch for my upgrade, excluded some files to keep it cleaner.

As expected, upgrade process did change code to pick index.js as entry point. I am not sure it would be possible to merge index.ios.js and index.android.js automatically, but probably.

I think it is sufficient to inform users about this change 😉

diff --git a/android/app/build.gradle b/android/app/build.gradle
index 8fab59d..77b7192 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -80,6 +80,10 @@ project.ext.envConfigFiles = [
 
 apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
 
+project.ext.react = [
+    entryFile: "index.js"
+]
+
 apply from: "../../node_modules/react-native/react.gradle"
 
 /**
diff --git a/android/app/src/main/java/com/app/MainApplication.java b/android/app/src/main/java/com/app/MainApplication.java
index 01d7c8c..ab01a1d 100644
--- a/android/app/src/main/java/com/app/MainApplication.java
+++ b/android/app/src/main/java/com/app/MainApplication.java
@@ -33,6 +33,11 @@ public class MainApplication extends Application implements ReactApplication {
         new ImagePickerPackage()
       );
     }
+
+    @Override
+    protected String getJSMainModuleName() {
+      return "index";
+    }
   };
 
   @Override
diff --git a/ios/app/AppDelegate.m b/ios/app/AppDelegate.m
index 4e1baef..a79f344 100644
--- a/ios/app/AppDelegate.m
+++ b/ios/app/AppDelegate.m
@@ -18,7 +18,7 @@
 {
   NSURL *jsCodeLocation;
 
-  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
+  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
 
   RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                       moduleName:@"app"
8reactions
grabboucommented, Oct 5, 2017

It’s not a breaking change since it should affect just new apps. See here: https://github.com/facebook/react-native/commit/6e99e314b232c315628c31f97a865c17c071ad23 - the commit modifies the HelloWorld app which is used as a template when using init.

I believe git-upgrade has an unwanted behaviour as it takes that change and applies it into your project whereas it doesn’t touch filesystem: https://github.com/facebook/react-native/blob/master/local-cli/upgrade/upgrade.js#L139-L147

Either:

  1. Remove index.android.js and rename index.ios.js to index.js if two files are identical
  2. Revert that change and stick to two separate entry points

Please pay attention to git diff after upgrading. All changes should be at a glance. It’s fine to revert them in AppDelegate.m and MainApplication.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am facing strange issue to run react-native app on iOS
You need to define in Xcode the bundle identifier something like "com.yourapp" clicking on the project target if I remember properly.
Read more >
ern-core: Versions
Breaking Changes. Detection of Electrode Native API and API implementation dependencies is no longer based on package name. This will only impact APIs...
Read more >
[Solved] react native New project fail to build on iOS (double ...
Installing build/Build/Products/Debug-iphonesimulator/PlayWithRN.app. An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Read more >
https://patch-diff.githubusercontent.com/raw/faceb...
Without fix `react-native run-ios` will open simulator from Xcode 9.4, with fix it'll open ... argument was not working correctly with the `bundle`...
Read more >
A Mapbox GL react native module for creating custom maps
Error in compiling for IOS simulator in new mac M1 chip. ... "metro-react-native-babel-preset": "0.49.1", "node-dir": "0.1.17", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found