Closed thecodrr closed 5 years ago
We'll need help debugging what's causing this. What does it mean that "it closes"? Can you share more details?
@thymikee well I can't see the error on it as it only blinks. How can I debug it?
Edit: after looking really closely, the Metro Bundler window is completely empty when it closes, so no error there.
Can you post a video? :D Set up some console.logs in commands/server/runServer.js
@thymikee runServer gives nothing so it's not even getting there.
Btw, does running yarn react-native start
works without issues? If so, check files related to this diff: https://github.com/react-native-community/cli/pull/310
Running launchPackager.bat
directly gives this error:
error: unknown option
--projectRoot'`
Doing yarn react-native start
gives me the console.logs I had set so I am guessing, runServer
is getting called in that case.
Running node .\node_modules\react-native\cli.js --projectRoot
also gives this error:
error: unknown option `--projectRoot'
Yea, because we removed this option. It's not necessary now. Can you remove it from https://github.com/facebook/react-native/blob/master/scripts/launchPackager.bat and see if that works?
@thymikee yup. Working without a hitch.
Yea, can you send a PR to RN? The patch release make take a while (cc @kelset). I think we should own these files, but that may be a bit bigger change.
@thymikee okay, I will do that.
removing node_modules/react-native/scripts/launchPackager.bat then even the splash window of Metro Bundler will not show, of course it's not running.
@zenz it's not about rmeoving the file, but doing this diff:
-node "%~dp0..\cli.js" --projectRoot ../../../ start
+node "%~dp0..\cli.js" start
@thymikee oops... yes, it's working now.
@thymikee can't we ship a temporary fix with the cli until RN releases the fix?
If you'd like to contribute this then of yea. I don't have too much bandwidth currently, just trying to be helpful.
It seems that another problem raised after modify this launchPackager.bat file. Metro Bundler tells me there's no index file
Error: Unable to resolve module
./indexfrom
C:\Users\zenz\programs\test_app\node_modules\react-native\scripts/.: The module
./indexcould not be found from
C:\Users\zenz\programs\test_app\node_modules\react-native\scripts/.. Indeed, none of these files exist:
But using react-native start to start the Metro Bundler is working correctly.
@zenz same here. I changed lanchPackager.bat
, Metro bundler shows up, but with this error.
Maybe projectRoot
parameter is necessary after all.
modify it like this, solves the problem:
@echo off
title Metro Bundler
call .packager.bat
cd ../../../
node "%~dp0..\cli.js" start
pause
exit
hard coding it to swith to root directory.
I think that makes sense, this is similar to what Linux script does: https://github.com/facebook/react-native/blob/master/scripts/launchPackager.command
@thymikee should I add it to the PR?
Let's make sure it works as intended, and then yes
@thymikee after adding the cd
command, the packager loads and bundles successfully. So it is working.
After the cd ../../../
command, it works successfully!
Hey guys, still having problems... Today I started a new RN project, after the setupe, my Metro Bundler opens, starts, but it keeps in the "Loading Depedency Graph..." screen. It starts to consume my computer memory like crazy and everything gets really slow, but the Metro Bundler don't finish the Dependency Graph proccess. Any workaround to that?
P.S.: I already tried the steps above!
@Inovassist-dev kill all background node process, run react-native start is it running correct or not?
Thx, zenz I have this problem
Environment
System:
OS: Windows 10
Yarn version:
1.16.0
Node version:
10.15.3
Platform:
win32 x64
react-native --version
react-native-cli: 2.0.1
react-native: 0.60.0
react-native run-android
`D:\ADS\curso-react-native\ReactNativeReduxGraphQl>react-native run-android info Starting JS server... info Installing the app...
Task :app:installDebug 01:20:29 V/ddms: execute: running am get-config 01:20:29 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1 01:20:29 V/ddms: execute: returning Installing APK 'app-debug.apk' on 'Pixel_3_API_28_86(AVD) - 9' for app:debug 01:20:29 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554' 01:20:29 D/Device: Uploading file onto device 'emulator-5554' 01:20:29 D/ddms: Reading file permision of D:\ADS\curso-react-native\ReactNativeReduxGraphQl\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------ 01:20:29 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk" 01:20:30 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1 01:20:30 V/ddms: execute: returning 01:20:30 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk" 01:20:30 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1 01:20:30 V/ddms: execute: returning Installed on 1 device.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 3s 27 actionable tasks: 2 executed, 25 up-to-date 'C:\Users\Anderson' n�o � reconhecido como um comando interno ou externo, um programa oper�vel ou um arquivo em lotes. info Connecting to the development server... info Starting the app... Starting: Intent { cmp=com.reactnativereduxgraphql/.MainActivity }
D:\ADS\curso-react-native\ReactNativeReduxGraphQl>`
Works only by executing commands 1st react-native start 2nd react-native run-android
or manually the project repositori https://github.com/Andersonfrfilho/ReactNativeReduxGraphQl
@Andersonfrfilho I don't see any error in your output. What's the problem?
I run @Andersonfrfilho 's code with modified launchPackager.bat. No errors and it runs well.
So I think he didn't modify the launchPackager.bat file
Just created a PR (#489) that should fix this for now. @thymikee waiting for your review.
@theweavrs good, this PR moves the commands into same place.
Just created a PR (#489) that should fix this for now. @thymikee waiting for your review.
when i applied the pr, i get a "fs is not defined error"
As a temporary solution, I've found a little workaround :
Run the Metro Bundler manually with react-native start
Then run as usual. I'm doing react-native run-android
You might be stuck with a blank screen after this, meaning you have to run again after Metro generated a build/bundle once. So force close the app, and then run as usual again while keeping the Metro Bundler running in the background.
You may also have to update your version of react-native-cli
to 2.0.2
Good as I saw the difficulty to find the error I posted a video showing what is happening now when I execute the commands https://youtu.be/6qiBeKnHYSc thank you to the impenetrate for trying to solve the problem
@Andersonfrfilho Please read above comments to find out the temporary solution. Sometimes the official release will be very late. Modify node_modules/react-native/scripts/launchPackager.bat Change the contents like below:
@echo off
title Metro Bundler
call .packager.bat
cd ../../../
node "%~dp0..\cli.js" start
pause
exit
Again I apologize for the inconvenience, but there is neither this executable nor the file in my node_modules
@Andersonfrfilho the path is ./node_modules/react-native/scripts/launchPackager.bat
, please read carefully.
sorry, I just review here I'll try, thx
Hey guys worked with the change in the .bat file ok, vlw but once thanks. Sorry for the inconvenience
Closed via https://github.com/react-native-community/cli/pull/489. Published in 2.1.1, please try give it a try (see how to update the CLI)
The changes in the .bat file made the metro bundler run without closing immediately. However, the metro bundler takes too long to load the dependency graph and then the app crashes in the emulator as soon as the BUNDLE process reaches 100%.
I'm running React Native 0.60 and I've updated @react-native-community/cli to 2.1.2
@naderabdalghani I suppose you use Node >=12.5, please downgrade to 12.4. See https://github.com/react-native-community/cli/issues/485#issuecomment-509210382
Memory usage has significantly improved after downgrading to node 12.4.0. However, the app still crashes after BUNDLE process reaches 100% or I manually open it
@naderabdalghani That's different issue, likely caused by configuration in your app. Please try a new project with a set of libraries you use and try to find the bug. If you're then sure it's something inside React Native or CLI, please file an issue accordingly.
Same error on Linux (Elementary OS) After running react-native start, i've got a blank screen. For a temporary fix, this work's fine.
Metro cannot start, so I run react-native start
then I got this error, anyone know how to fix this?
events.js:174
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'D:\WarungPintar\kurir-app\node_modules\.bin\JSONStream'
Emitted 'error' event at:
at NodeWatcher.checkedEmitError (D:\WarungPintar\kurir-app\node_modules\metro\node_modules\sane\src\node_watcher.js:143:12)
at Walker.emit (events.js:198:13)
at D:\WarungPintar\kurir-app\node_modules\walker\lib\walker.js:52:12
at D:\WarungPintar\kurir-app\node_modules\graceful-fs\polyfills.js:282:31
at FSReqWrap.oncomplete (fs.js:153:21)
I have recently upgraded to RN 0.60.0 from 0.57, after running "react-native run-android" the configurations from build.grade executes successfully. But the metro bundler launches and doesn't loads and says it's done. The app crashes, as the metro bundler doesn't run.
Any approach to fix this? @thymikee
Does running react-native start
first help? Also, if you use Node 12, make sure to upgrade to 12.9+, there was a bug in V8 that affected Metro.
Environment
Description
Doing
yarn react-native run-android
opens themetro bundler
but it immediately closes. Don't know if its a bug with thecli
or themetro
itself. This only happens on Windows, I think.Things I have tried:
Reproducible Demo
react-native init
yarn react-native run-android