Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console.log doesn't work in React Native application after migration to TypeScript

After adding dependencies and started project (still full of js code) in an ios simulator, console.log doesn't print anything.

I can check for sure that code gets called, but when I put console.log in any js file, or ts file with any argument nothing appears in my TERMINAL.

I use a VS Code if it matters somehow. Also, I use expo

Not sure what info I can provide to diagnose, so if I can help to understand the issue somehow - please write.

Logs appear after I restart build. So I can see logs from previous run

Logs also appear in Chrome console, so the only place I can't see them is VS Code

like image 616
Vladyslav Zavalykhatko Avatar asked Mar 23 '26 03:03

Vladyslav Zavalykhatko


2 Answers

For debugging and see the console.log the best way I found is by using Debug Remote JS after you have clicked on CMD+D. This way that open chrome and now you can see all your javascript log. Also a tool I use is https://github.com/jhen0409/react-native-debugger who let use the redux-devtool also. But for running it in expo you need to add this script in your package.json.

"debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=19001'" This will open this debugger in the same port as expo.

like image 180
EQuimper Avatar answered Mar 25 '26 17:03

EQuimper


I managed to get logs back using exp start instead

like image 39
Vladyslav Zavalykhatko Avatar answered Mar 25 '26 16:03

Vladyslav Zavalykhatko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!