Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android][Windows] packager.js bug crashes development server! #2787

Closed
BerndWessels opened this issue Sep 17, 2015 · 13 comments
Closed

[Android][Windows] packager.js bug crashes development server! #2787

BerndWessels opened this issue Sep 17, 2015 · 13 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@BerndWessels
Copy link
Contributor

Hello

It seems the development server that serves the JavaScript to the App has broken code (on Windows).

Calling this to run the development server: node node_modules/react-native/packager/packager.js works fine until the App requests the JavaScript Bundle. That causes the development server to crash:

The crash looks slightly different every time, here are some examples:

    <--- Last few GCs --->

      299789 ms: Scavenge 1401.1 (1455.6) -> 1401.1 (1455.6) MB, 7.4 / 0 ms (+ 2.0 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
      300662 ms: Mark-sweep 1401.1 (1455.6) -> 1401.0 (1455.6) MB, 872.8 / 1 ms (+ 3.0 ms in 2 steps since start of marking, biggest step 2.0 ms) [last resort gc].
      301517 ms: Mark-sweep 1401.0 (1455.6) -> 1401.0 (1455.6) MB, 855.0 / 0 ms [last resort gc].


    <--- JS stacktrace --->

    ==== JS stack trace =========================================

    Security context: 00000394AB737349 <JS Object>
        1: join [path.js:~217] [pc=000000C79FE49004] (this=000003690CB64909 <an Object with map 000003B796023E19>)
        2: arguments adaptor frame: 3->0
        3: /* anonymous */(aka /* anonymous */) [Y:\Mobile\node_modules\react-native\packager\react-packager\src\DependencyResolver\DependencyGraph\ResolutionRequest.js:~226] [pc=000000C7A12131DA] (this=00000394AB704131 <undefined>,realModuleN...

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

Another one:

    <--- JS stacktrace --->

    ==== JS stack trace =========================================

    Security context: 000000A2FB137349 <JS Object>
        1: split(aka split) [Y:\Mobile\node_modules\react-native\node_modules\babel-core\node_modules\core-js\modules\es6.regexp.split.js:7] [pc=000003ABD89C3ED4] (this=0000033DA680BFD9 <String[33]: \node_modules\regenerator/runtime>,separator=0000033DA680BF91
    <JS RegExp>,limit=000000A2FB104131 <undefined>)
        2: arguments adaptor frame: 1->2
        3: normalize [path.js:193] [pc=000003ABD8...

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

This makes it impossible to use React Native on Windows.

Please help to fix this, thank you

Bernd

@mqli
Copy link
Contributor

mqli commented Sep 17, 2015

Same issue,haven't find a way around it yet.

@mqli
Copy link
Contributor

mqli commented Sep 17, 2015

Hey. Just find out the problem
https://github.com/facebook/react-native/blob/master/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js#L229

          for (let currDir = path.dirname(fromModule.path);
               currDir !== '/';
               currDir = path.dirname(currDir)) {
            searchQueue.push(
              path.join(currDir, 'node_modules', realModuleName)
            );
          }

currDir !== '/'; does not match window root path, and it fall into a dead loop, this will make the server work

          for (let currDir = path.dirname(fromModule.path);
               currDir !== path.parse(fromModule.path).root;
               currDir = path.dirname(currDir)) {
            searchQueue.push(
              path.join(currDir, 'node_modules', realModuleName)
            );
          }

Yet, still get a blank Activity with no UI,haven't find out why yet.

mqli added a commit to mqli/react-native that referenced this issue Sep 17, 2015
The issue here facebook#2787

The root path '/' dosn't match windows root path
@BerndWessels
Copy link
Contributor Author

Awesome @mqli .

I tried your fix and it works as you described.

The http://localhost:8081/index.android.bundle?platform=android endpoint returns JavaScript and the App in the emulator loads it.

Unfortunately the app is blank white.

So close now to finally be able to use react-native android on windows.

Please keep on digging and let me know if I can help in any way to find the final fix.

Cheers
Bernd

@jozn
Copy link

jozn commented Sep 17, 2015

+1 for support for Windows.
I hope somebody make it right soon and commit changes to master.

@mqli
Copy link
Contributor

mqli commented Sep 17, 2015

@mkonicek
Copy link
Contributor

Awesome!

@mkonicek
Copy link
Contributor

Please send a pull request and we'll get someone working on the packager to review it.

@mqli
Copy link
Contributor

mqli commented Sep 17, 2015

Well, It's only a temporary workaround,I will send a pull request after more test and debug.

@ide ide added the packager label Sep 17, 2015
@BerndWessels
Copy link
Contributor Author

Thank you so much @mqli.

I started from scratch, added all your fixes and have a great working React-Native Android App on Windows!

This is fantastic news and I hope it will make it into the React-Package soon.

There is one last thing I noticed which is a bit of:
When running react-native run-android it says Starting JS server..., but that seem to do nothing.
I have to manually start it with react-native start.

This is not a big problem, but might confuse everybody who is new to react and might cause a lot of issue reports.

Anyway, thank you so much @mqli and we are looking forward to double the React community size with Android and Windows developers to build and share fantastic components.

@BerndWessels
Copy link
Contributor Author

Hi @mqli and @mkonicek .

Can you also please have a look into this issue.

I think you might be able to fix it, since it looks like a similar problem with child_process.spawn.

Thanks again
Bernd

ghost pushed a commit that referenced this issue Sep 18, 2015
Summary: The issue here #2787

The root path '/' dosn't match windows root path
Closes #2789

Reviewed By: @​svcscm

Differential Revision: D2452718

Pulled By: @martinbigio
@kmagiera
Copy link
Contributor

Referencing #2693 here as a master task for tracking all linux/windows efforts

@flyher
Copy link

flyher commented Oct 10, 2015

@mqli
thank you,but there is another question of red screen!

update:
this link can answer red screen question:
http://stackoverflow.com/questions/32572399/react-native-android-failed-to-load-js-bundle

it works!

MattFoley pushed a commit to skillz/react-native that referenced this issue Nov 9, 2015
Summary: The issue here facebook#2787

The root path '/' dosn't match windows root path
Closes facebook#2789

Reviewed By: @​svcscm

Differential Revision: D2452718

Pulled By: @martinbigio
@mkonicek
Copy link
Contributor

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/androidwindows-packagerjs-bug-crashes-development-server

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix. We rely on the community to provide
bugfixes as the core team is focused on performance.

cpojer pushed a commit to facebook/metro that referenced this issue Jan 26, 2017
Summary: The issue here facebook/react-native#2787

The root path '/' dosn't match windows root path
Closes facebook/react-native#2789

Reviewed By: @​svcscm

Differential Revision: D2452718

Pulled By: @martinbigio
@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants