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.

console.log commands are not shown their code line locations

See original GitHub issue

🐛 Bug Report

Environment

  Expo CLI 3.15.4 environment info:
    System:
      OS: macOS 10.15.3
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
      npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5977832
      Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^36.0.0 => 36.0.2
      react: 16.9.0 => 16.9.0
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4
      react-navigation: ^4.0.10 => 4.0.10
    npmGlobalPackages:
      expo-cli: 3.15.4
App's target: iOS and Android

Steps to Reproduce

Create a new project using expo init new-project. Do console.log() in your code, or cause error somewhere in your code.

Expected Behavior

In google chrome console, or in React Native Debugger, the file name and the exact line of code must be shown on the right-hand side where the console.log was written, or where the error happens. Like this : (Here I used pure react native project , No expo): Screenshot 2020-03-19 at 21 11 55

Actual Behavior

It always shows RemoteConsole.js:80: Screenshot 2020-03-19 at 19 54 44

Reproducible Demo

https://github.com/ghasemikasra39/new-expo-project

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
m-deaconcommented, Dec 18, 2020

@ghasemikasra39 and anyone else with this issue, I’ve finally found the solution (and it is actually in expo’s docs 🤦‍♀️):

Line numbers for console.log statements don’t work by default when using Chrome debugging. To get correct line numbers open up the Chrome Dev Tools settings, go to the “Blackboxing” tab, make sure that “Blackbox content scripts” is checked, and add expo/build/logs/RemoteConsole.js as a pattern with “Blackbox” selected.

source: https://docs.expo.io/workflow/debugging/#remote-debugging-with-chrome-developer-tools

0reactions
ghasemikasra39commented, Jun 17, 2020

dear @m-deacon I am still getting the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo console.log commands are not shown their code line ...
Line numbers for console.log statements don't work by default when using Chrome debugging. To get correct line numbers open up the Chrome ...
Read more >
Console app not showing info and debug logs
I've tried running the Console app as root, via sudo from the command line and the same issue occurs; no debug or info...
Read more >
Debugging - React Native
Accessing console logs​. You can display the console logs for an iOS or Android app by using the following commands in a terminal...
Read more >
Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >
Browser Console — Firefox Source Docs documentation
NB: The Browser Console command line (to execute JavaScript expressions) is disabled by default. To enable it set the devtools.chrome.enabled preference to ...
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