source maps are not working when debugging with chrome
- Version: 6.3.1 +
- Platform: OSX
I am debugging my mocha tests using native node debugger, using the following command:
/usr/local/bin/node --debug-brk --inspect=9444 --expose_debug_as=v8debug /Users/yanivef/Documents/projects/node-debug-example/node_modules/mocha/bin/_mocha --require babel-register --timeout 0 --ui bdd test/**/*.spec.js
Debugger works great, but I cannot make source maps to work.
I created a small simple example here.
Just clone + npm i + npm run test-debug. You'll see that when opening the address from command line (chrome-devtools://devtools....) you can debug but source maps are not working:

I tried adding project to workspace / adding source maps manually with no luck. Am I doing something wrong here? Is there an issue here?
Looks like Firefox's https://github.com/devtools-html/debugger.html/ works with Node 6 if you want to compare debuggers.
Is there anyway to open up the chrome debug link automatically rather than copying and pasting everytime?
@RanjithNair Latest chrome exposes it directly in the devtools as an experiment, generally you can have "chrome://inspect" open and a link you can click will just pop up.
@eugeneo , @s3ththompson: when do we remove auto-attach from behind experiments in Chrome?
@RanjithNair view this https://github.com/nodejs/node/issues/9185 issue, I write a proxy to workaround the uuid problem
Based on @joshunger's idea. The following works for me:
- Launch chrome with:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --user-data-dir=/tmp/chrome-dev-profile - Visit the debug URL from
node --inspect --debug-brkcommand. For example:chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/32b58564-d201-4d3b-9174-272cee84146f
@RanjithNair checkout this module: https://github.com/jaridmargolin/inspect-process
Its basically a convenience wrapper around --inspect option. Works great for me so far.
Node Version: v7.7.1 Platform: Win 10 Chrome: 58.0.3029.6 node --debug-brk --inspect Source maps are not working in Developer Tools node source panel
Platform: win7 Tested browsers:
- Chrome Canary Version 59.0.3049.0 (Official Build) canary (64-bit)
- Chrome Version 59.0.3047.4 (Official Build) dev (64-bit)
Node version: v7.7.4 Inlined sourceMaps still don't work
Finally debugging es6/babel source maps is working correctly with me: Platform: Ubuntu 16.10 Chrome: Version 57.0.2987.98 (64-bit) Node: v7.7.1
The only way I was able to debug remote typescript on node 7.7.4 was to inline maps and source files with:
"inlineSourceMap": true,
"inlineSources": true
in tsconfig.json so it looks like:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"alwaysStrict": true,
"inlineSourceMap": true,
"inlineSources": true
},
"exclude": [
"node_modules"
]
}
Otherwise Chrome and WbStorm 2017.1 don't even show .ts files.
@sffetlio Well, with that settings on the tsc2.2.1 I got this:
error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'
Anyway it's not so critical to debug w/o sourcemaps but with them it would be much more better.
Yes, I just checked, I got this too when running tsc. I'm using WebStorm and it doesn't complain.
Still, debugging works for me without "sourceMap": true,.
I tried to repro the issue from the original comment and it looks like it is working (e.g. DevTools status bar shows that the file is source mapped, breakpoints seem to be working):

@eugeneo What the platform and nodejs working with and tool that generates these sourcemaps?
I used the original repro from this issue (i.e. the top post).
@eugeneo Updated my comment above. See again pls.
@hinell I was using repro from to very first comment by @yanivefraim
@eugeneo, if you would, please specify node.js version and OS. I have tried example from first comment and it doesn't work. My specs: node.js : 7.7.1, win 10 x64, Chrome version 58.0.3029.41 beta, Chrome Canary version 59.0.3062.0
Upd. Have checked it with Ubuntu 16.4, latest Chrome Dev and node 7.7.1 - it works, and seems i've got the difference. It's strange, because i ran node.js and chrome with admin rights on Windows. Chrome Dev 59.0.3053.3
I am building Node from sources. Do you have source maps embedded?
On Wed, Apr 5, 2017 at 5:49 AM georgiy-abbasov [email protected] wrote:
@eugeneo https://github.com/eugeneo, if you would, please specify node.js version and OS. I have tried example from first comment and it doesn't work. My specs: node.js : 7.7.1, win 10 x64, Chrome version 58.0.3029.41 beta https://www.screencast.com/t/ZozrHQFMzu6U, Chrome Canary version 59.0.3062.0 https://www.screencast.com/t/rWePHkxgYbSF
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejs/node/issues/8369#issuecomment-291850847, or mute the thread https://github.com/notifications/unsubscribe-auth/AARkrS4DbO_xRVOoXsnZrXuULKQ-zNdqks5rs42_gaJpZM4JytlQ .