When I console.log()
, the Chrome console gives the log but instead of showing the file and line number it just says react_devtools_backend.js:4049
. How do I get the console to show the file and line number when I console.log()
?

- 20,799
- 66
- 75
- 101

- 1,113
- 2
- 5
- 5
-
1Check the second answer to this question. Should be the accepted answer. – Robin Wieruch Jun 13 '23 at 11:43
10 Answers
I was able to fix it in my console by adding the file to my Framework Ignore List in Chrome. Steps:
Console -> Gear icon (top right) -> Settings -> Framework Ignore List.
Add react_devtools_backend.js
to the list and the console.log
should start showing the correct mapping again.
-
2Not sure if that's the best solution cause m.b. it will be needed in future? But at least it is working, thanks. – Artem Luzhanovskyi Sep 28 '21 at 11:33
-
So what are you saying is that my page does not render for the second time? – Farbod Shabani Dec 10 '22 at 07:42
-
It can be disabled in "Components tab". Click the "Gear" icon:
Then check "Hide logs during second render in Strict Mode" in the "Debugging" tab:
-
2
-
-
-
2Disabling "show inline warnings and errors" works for me in Firefox. Would be helpful if this answer actually specifically mentions the relevant option and how to set it. right now it's not really a direct answer to the question. – ThaJay Apr 04 '23 at 08:20
To add a bit more context apparently "it doesn't need a fix" as it's working as intended as per version 18 of 1st of September 2021. See comment of one of the developers on the React GitHub issue.
Quoting here in case you don't want to check the log or it gets deleted:
As of the version 18 release, DevTools always overrides the native console to either dim or suppress StrictMode double logging. (Before it only did it if you enabled a feature like component stacks.)
The major unfortunate drawback of this overriding is that it changes the location shown by the browser's console as reported in this issue.
So I guess that until they change their minds or browsers provide better support, it's time to switch off the extension.

- 2,247
- 3
- 15
- 32

- 571
- 4
- 7
-
8My goodness, it's not really workable, having to enable and disable the extension constantly... Thanks for the info mate! Welcome to Stack :) – Guido Visser Sep 13 '21 at 10:08
We can use
console.info(data)
instead of
console.log(data)

- 7,796
- 12
- 36
- 53

- 379
- 2
- 4
-
3The problem if when an error occurs and the code "breaks", so the developer wants to catch and debug, and if the extension is catching the error before the "real" code does, then the ability to know the exact line of failure is lost – vsync Jan 17 '22 at 17:41
I have the same problem since yesterday in both Edge & Chrome, not exactly a solution just a temporary workaround: just disable the react-devtools extension from your browsers extensions.

- 59
- 2
Render your App without the strict mode:
root.render(<App />)
Instead of:
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
)

- 283
- 1
- 2
- 12
This may be due to the source map option disabled in webpack config file. You need to change your devtool in webpack config as
devtool: "source-map"
or you can control source map generation according to your need. check the documentation of devtool webpack

- 193
- 1
- 1
- 8
-
1Problematic when using `react-scripts` which handles all the *Webpack* for you as a "black-box" – vsync Jan 17 '22 at 17:43
As of React DevTools version 19 of 29 September 2021, this issue has been addressed, as per the comment on the GitHub issue page.
So it should show the file and line number again after we update the React DevTools extension to version 4.19.0
.

- 2,247
- 3
- 15
- 32
This may happen if you are using React devtools extension in chrome. simply just go to chrome://extensions/ and check, If found then remove it. In my case it worked.