I tried a whole day to get remote debugging with break points on my VM, but I didn't succeed. I have read all old issues, blog posts and SO. But I still cannot figure out what I've done wrong?
I have a VM running locally on my Mac at host app.local. Inside the VM I have a folder /home/myusername/app, I have a TS project. Here is my configurations :
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": true,
"outDir": "Build",
"rootDir": ".",
"experimentalDecorators": true,
"jsx": "react",
"reactNamespace": "Element",
"removeComments": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"noEmitOnError": true,
"noImplicitThis": true,
"inlineSourceMap": true,
"inlineSources": true
},
"exclude": [
"node_modules",
"vendor"
]
}
And here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"address": "app.local",
"port": 5858,
"sourceMaps": true,
"localRoot": "${workspaceRoot}",
"remoteRoot": "/home/myusername/app",
"restart": true
}
]
}
I can see the generated files have inlined source map and inlined sources(I have also tried with non-inlined mapping as well). I start the server node-dev --debug Build/Start.js. After that I attach to the process and succeeds. But the problem comes when I try to set a break point โ it fails?
I have also tried many remoteRoot paths to hopefully get the breakpoints working, though failed? I don't think I have a remote idea what I've done wrong at this moment.
I'm not able to make it work with docker as well (a nodejs/express/typescript app).
I've spent hours on trying all possible combinations of remoteroot, localroot, outdir, inline & external sourcemaps without any success?
Can someone possibly make a clear statement about whether it is supposed to work?
And if yes maybe come up with a sample (a docker sample would be great as it would make it possible to easily run it without complex setup) that would clarify the necessary configuration settings.
That's really frustrating to spend hours and days on something that is maybe not working at all.
For information, I was able to remode debug pure nodejs/express javascript.
@FredericLatour are you able to set and hit breakpoints in *.js files if the "sourceMaps" attribute in your launch config is set to false?
@weinand As written I was able indeed to remode debug (and set breakpoints) if no sourcemaps are involved but maybe you are asking for something more specific?
@FredericLatour I'm asking whether you were able to set and hit breakpoints in *.js files in your Docker/TypeScript app when the "sourceMaps" attribute in your launch config is set to false. If yes, then this means that remoteroot, and localroot are correctly set and we can focus on the source map issue.
I'm not asking about a different nodejs/express javascript app.
@weinand . Ok. As far as I remember (have done hundreds of tries since then): yes. But for the sake of starting on the right track, I will check right now and will let you know.
As far as I can understand, you are meaning that this is supposed to work. Don't want to look like I'm insisting but why not having a sample docker based repository posted? I mean, if I can clone a repository and see by myself that this is working properly, not only I would be confident to spend additional time on this but also I'll be able to compare the sample configuration/settings with my own configuration.
Will check your specific question now and post back the result.
I've just verified on macOS with Docker that this project made available by @delfinof in https://github.com/Microsoft/vscode/issues/2472 works for me without modification. I can set breakpoints in index.ts and they are hit reliably.
@FredericLatour yes, I could post sample projects on github for thousand of interesting node.js + something (e.g. Docker) use cases but I'm actually a developer on the VS Code team, not on the Docker team ;-)
I prefer @delfinof's approach: he helped me with a small sample project that showed a problem with source maps in a Docker setup, I fixed a bug in node-debug and now the project can be used an an example that VS Code & Docker & source maps seem to work.
If it doesn't work for you let's try to find out what the difference might be...
@weinand I see what you mean but at the same time, I can't see hundreds of use-cases involving local/remote stuff with vscode. Besides "editing features", debugging is a hot topic ... And being able to debug "typescript" MS great js superset from another great MS tool "vscode" using current modern dev workflow (docker/vagrant/what else...) seems not even optional to me but I may be biased ...
the docker sample is just an easy way for you (vscode team) to provide a sample that shows explicitly that remode debugging is working both with and without sourcemaps.
It could be a VM as well, but you will have a hard time to provide a VM that can be used _as-is_ whereas a docker config for local/remote debuging can be run in a matter of minutes.
Yes, the @delfinof project is exactly what I was suggesting. However I tried it and it didn't work. But not being published from vscode team, it was hard to say this sample is confirmed to be working on both windows and mac. Moreover, as you can see, the launch config is different between windows (a specific IP address 10.0.75.2) and mac (address = localhost). That's a bit surprising considering that docker for windows works the same way.
Still will retry @delfinof sample ... could have been tired the other day after hundreds of configuration settings changes...
Now if you have someone that has both Windows 10 and docker for windows in your team ... that would be great if this person could give it a try (just need 10 minutes).
Will post back my results .
FYI tried on 2 different projects and on 6 occasions. Debugging with breakpoints have never worked for me since VSCode launched. Many hours lost.
@FredericLatour I suggest that you try to run the docker sample from #2472 on Windows 10 since that seems to be platform where you've experienced the problem (you didn't mention what OS and node version you are using, so I just picked OS X).
If it doesn't work for you then we have a reproducible test case.
And please enable source map tracing by adding this attribute/value to the launch config:
"trace": "sm"
@weinand Tried on my project. Set sourceMaps to false, removed outDir settings, set localRoot to the dest folder (where I generate typescript or copy js files for those files that are pure js)
{
"name": "bo-server",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": true,
"sourceMaps": false,
"localRoot": "${workspaceRoot}/build/server",
"remoteRoot": "/code/build/server"
},
Now for some reasons, I can breakpoint in pure js files (files copied from src to build folder without transpilation) but not in js files transpiled from typescript. Doesn't make anys sense if you ask me!!
I thought that maybe it was the reference to the sourcemap within the js file:
Still not able to break point in js files that are transpiled from ts. Those things can make you crazy ... Any idea what is happening here?
@weinand Will now try to run the sample from #2472 again (as you can see in issue thread, I had posted a message indicating that it was not working for me).
Sure I've understood that, but you did not try it with "trace": "sm".
Sure I've understood that, but you did not try it with "trace": "sm".
@weinand I don't think I've seen this option before. It is neither in the docs?
https://code.visualstudio.com/docs/editor/debugging#_node-debugging
@tinganho "trace" is a new internal setting that helps when investigating problems. It is not (yet) an official end user setting.
@FredericLatour please use the "trace" option on your project as well. Watch out for paths where the case of the drive letters doesn't match.
@weinand OK, I tried with that option, but it still doesn't work for me. It says cannot find the generated
Breakpoint ignored because generated code not found (source map problem?)
Just curios what outDir setting means? outDir in remote or outDir in local? Tried giving both an absolute path but it still doesn't work.
@weinand Where am I supposed to get "trace" information?
@FredericLatour on the debug console
@tinganho the "trace" option cannot 'fix' anything magically. It just a verbose option for the debugger. Let me know what "trace" prints on the debug console.
I got breakpoints working now. You really need to document outDir it should be the "mounted" compiled output directory on local. Even though you compile it on remote. At least, it is how I got it to work. With TypeScript compiled with --inlineSources and --linlineSourceMap I don't think people expect that outDir is even needed?
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "app.local",
"restart": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/local",
"localRoot": "${workspaceRoot}",
"remoteRoot": "/home/myusername/app"
},
But thanks anyway for the assistent.
@weinand I don't get anything in the debug console ... not sure what's going on here
{
"name": "Attach to docker (win)",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"outDir":"${workspaceRoot}/tssrc",
"localRoot": "${workspaceRoot}",
"trace": "sm",
"remoteRoot": "/mnt"
},
what version of VSCode are you using?
@weinand 1.4

@weinand I really don't get how you get this sample to work immediately. It doesn't even see the ts file in my case:


@weinand Moreover, in all honesty, this is not your typical app structure. Transpiled "js" file in the same folder as the typescript folder.. We can never be sure that some side effects are not involved here... With such a configuration localRoot, remoteRoot and outDir settings don't necessarily clarify things.
When I see so many hours, days, posts, frustration, etc ...
Wouldn't it be time for a sample meaningful project that would explain it all.
root nodejs folder (with package.json and so on:
|
|-- src/ : source folder with typescript file
|-- dist/ (or build) : distribution folder - transpiled files and others...
|-- typings/
|-- ...
And now in that case
What about SourceMap generation: inline, separate files ? Are both supposed to work?
@FredericLatour since you are a Docker professional, it would be great if you could create the "meaningful" (but still minimal) project that has the desired structure and shows how to set things up.
That would be a very constructive contribution to VS Code.
@weinand I'm far from being a Docker pro. I started to investigate this tech a month ago or so. the basics are really easy to understand. Being able to run the sample on your Macbook makes you as Pro as I can be :)
I was using Vagrant before and had the same problems for remote debugging. It was working with Visual Studio 2013 though because they were using some kind of proxy script for remote debugging.
_That would be a very constructive contribution to VS Code._
Hopefuly you are not meaning I'm not constructive by trying desperately to get remote debugging with sourcemaps working or at least trying to know if it is supposed to work which is still not really clear at this time.
I could certainly try to come up with a sample as a starting point but before that can you please:
Considering a fairly standard structure:
_root nodejs folder app (with package.json and so on):
|
|-- src/ : source folder with typescript file
|-- dist/ (or build) : distribution folder - transpiled files and others...
|-- typings/
|-- ..._
Considering that folder _/code_ in the docker container is mapped to the local root nodejs folder app.
What am I supposed to use for the following settings:
Are all combination of sourceMaps generation supported? (inline, separate map file)
Do I need to inline the source or it doesn't make any difference?
That would be a good starting point for building a meaningful sample :)
@tinganho Out of curiosity, did you try the sample docker project here?
VS Code node-debug doesn't do anything special for Docker, so for node-debug the Docker setup is just the "remote debugging" use case.
For that reason I cannot answer the question what does work with Docker and what doesn't. I can only say what node-debug supports in the remote debugging case.
localRoot and remoteRoot are used to convert paths between remote and local file systems. If a remote path has a prefix remoteRoot it is removed and the prefix localRoot is prepended (and vice versa).
outDir is used when a breakpoint in source has to be mapped to a breakpoint in generated JavaScript (because node-debug doesn't do an exhaustive search through all project files).
So if your generated code does not live side by side with the source, outDir must be specified.
All combination of sourceMaps generation are supported as long as separated source maps and separated source is kept in the local filesystem (because node-debug has no access to non-loaded *.js files in the remote filesystem).
@weinand Docker is nothing special. Just an easy way to set up a remote/local environment.
The main point is remote debugging with sourcemaps.
If you do not like this docker thing just replace docker container by remote machine/server/whatever.
It doesn't help a lot to provide localRoot, remoteRoot, etc, definitions. We all know it's prone to interpretation. Should it point to the project root? The folder where the source is located?
Why does it sound so difficult to provide a basic working configuration with the appropriate settings just to clarify things?
The state of the situation seems that some people seems to get it to work miraculously without exactly knowing how after tweaking settings hundreds of time.
How is it tested on your side? Don't you have a testing environment for running this? If so can you provide the folder structure (remote/local) and your settings?
Nothing about getting someone testing the sample docker project under windows 10? It seems to work immediately on Macbook and fail on windows 10 (as far as I can tell). Doesn't it sound interesting to see if someone can confirm or infirm this? I mean if it works on windows for you ... it could say there is definitively something wrong on my side.
@weinand Should I expect anything from your side or am I on my own? Don't want to wait for nothing.
We will put this on the September plan.
@weinand To tell the truth that's a bit beyond me that you still haven't given a try to the sample you mentioned earlier under windows 10.
I mean, in your position, after having run the sample without any problem under Macbook, I would have had some doubts about the guy in the opposite camp ( that is me in this context ) and would have
immediately found a way to give it a try under windows 10 ( in the worst case: 15 minutes install for docker + sample repo cloning + running the sample). Just to be sure the guy (still me) is not just not with it.
Anyway, no other choice than going ahead on my own in the meantime ... and maybe after a thousand of settings, tsc generation and folder structure combinations, I will get it to work by luck.
Hitting TypeScript breakpoints in the unmodified sample works fine on Windows 10 in the VS Code - Insiders.
@weinand sounds crazy but will restart back from the beginning - cloning the repo and following the instructions in the readme.md.
@weinand Just tried again and it doesn't work any better. Just trying to understand here.
Can you confirm that unlike what is written in the sample readme.md you had to run "npm run-script dockerdebug" and not just "npm dockerdebug"...
Running docker debug:

Setting breakpoints in ts:

running debugger with "Attach to docker (win)
As you can see it breaks into the js file (debug-brk) and not ts file.
Moreover ts breakpoints are greyed..

This is just crazy that you are able to make this work while I am not ... The steps are easy enough and it's hard to think of anything I would be missing....
Yes, I had to add the run-script flag to npm and I had to enable sharing for my 'C' drive.
What do you mean by VS Code - Insiders?
@weinand Could be the reason it doesn't work then?
I posted a screenshot of the vscode version I'm using and you didn't make any comment.
Sure, that could be. I didn't try with 1.4.
@weinand I had great hope with this insider but it didn't change anything ... the exact same problem...
Now the last think I can think of is that my project is on a "D" drive. Will install it on "C" drive and see.
Question:
When you run the debugger, does it break on the first line right in the "ts" file?
@weinand It doesn't work any better on the c drive ... this is just insane.
What version of tsc are you using? It should be displayed on the command line when running npm run-script dockerdebug.... (trace=sm doesn't have any effect at all in this situation) ...
This is just getting crazy .... will open another issue and ask to other users if they mind giving it a try ... What do you think?
@weinand I have looked a bit deeper and I have a hard time to understand how you make this work without any changes ...
The js and map files are generated in the "obj/tsout" folder...
As soon as I copy index.js and index.js.map file, from tsout into tssrc, it works....
Alternatively, I can make it work by:
"dockerdebug": "grunt && dockernode --debug --debug-brk obj/tsout""outDir":"${workspaceRoot}/obj/tsout"Now I'm not really into grunt ... is the grunt file supposed to copy files from tsout to tssrc? If this is the case, it doesn't work on my side.
That said, it seems a bit weird to copy back the generated files .... in the source folder.
I just added a "VS Code Recipe" for how to debug transpiled source in Docker with VS Code. Please see https://github.com/weinand/vscode-recipes/tree/master/Docker-TypeScript
I'm happy to see I'm not alone in the remote-debugging issues area.
I'm new to the process of filing a bug, although I'm not sure it is even a bug yet.
I have a nodejs, babel, webpack 2 server that I try to debug using the remote debugger.
I get all sorts of weird stuff going on, for example:
For the sake of simplicity I'm trying to remote debug using the localhost (although my app is running inside a docker).
Note: I even tried to use the 'show loaded scripts' feature in VSC and add breakpoints inside the loaded script but the problems above still occur.
The only way, for me, to debug is by the --inspector and using the chrome-devtools link.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"localRoot": "${workspaceRoot}",
"remoteRoot": null,
"outFiles": ["${workspaceRoot}/**/*.js"],
"smartStep":true
}
]}
````
**.babelrc**
```javascript
{
"presets": [
"es2015-webpack"
],
"sourceMaps": true,
"plugins": [
"transform-runtime",
["transform-es2015-modules-commonjs-simple", {
"noMangle": true
}],
[
"babel-plugin-webpack-alias",
{
"config": "./webpack.config.dev.js"
}
]
]
}
webpack.config
import path from 'path';
import fs from 'fs';
import webpack from 'webpack';
export default {
entry: "./server.js",
target: 'node',
externals: fs.readdirSync("node_modules"),
devtool: 'inline-source-map',
output: {
path: path.join(__dirname, "build"),
filename: "[name].js",
},
resolve: {
extensions: [
"*",
".js",
".json",
]
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [
"babel-loader"
],
}
]
},
devServer: {
contentBase: path.join(__dirname, "api")
},
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
})
]
}
Please bear in mind this is the current settings I have after trying multiple solutions shown online, but I'm still stuck with this issue.
Can you please assist @weinand ?
Hello there!
I'm having a very hard time trying to setup remote debugging as well.
I have a Node.js application written in TypeScript. I'm using Docker container to transpile and run the application in development environment. I've managed to expose the port and to connect to it with the IDE. However, I can't make breakpoints to work from source TypeScript files. They are just turning grey when I connect to the running app.
/home/sfomin/projects/app,./src,./.build/compiled,/opt/project, the relative directories are the same,node --inspect-brk=0.0.0.0:9229 ./.build/compiled/cli.js.My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Remote Debug",
"type": "node",
"request": "attach",
"protocol": "inspector",
"port": 9229,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/.build/compiled/**/*.js"
],
"localRoot": "${workspaceRoot}",
"remoteRoot": "/opt/project",
"trace": true
}
]
}
Here's example source map file:
{
"version": 3,
"sources": [
"cli.ts"
],
"names": [],
"mappings": ";;;AAEA,4BAA0B;โฆ",
"file": "cli.js",
"sourcesContent": ["โฆ"]
}
It's referenced like this from the transpiled file: //# sourceMappingURL=cli.js.map.
And here's the part of the debug trace log:
โ From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"60","url":"/opt/project/.build/compiled/cli.js","startLine":0,"startColumn":0,"endLine":12,"endColumn":3,"executionContextId":1,"hash":"143694101549CA67BC820764FE83C5E426C38377","isLiveEdit":false,"sourceMapURL":"cli.js.map","hasSourceURL":false,"isModule":false}}
Mapped remoteToLocal: /opt/project/.build/compiled/cli.js -> /home/sfomin/projects/app/.build/compiled/cli.js
SourceMaps.getMapForGeneratedPath: Finding SourceMap for /home/sfomin/projects/app/.build/compiled/cli.js by URI: cli.js.map
SourceMaps.loadSourceMapContents: Reading local sourcemap file from /home/sfomin/projects/app/.build/compiled/cli.js.map
โ From target: {"method":"Debugger.paused","params":{"callFrames":[{"callFrameId":"{\"ordinal\":0,\"injectedScriptId\":1}","functionName":"","functionLocation":{"scriptId":"60","lineNumber":0,"columnNumber":10},"location":{"scriptId":"60","lineNumber":0,"columnNumber":10},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":1}"},"startLocation":{"scriptId":"60","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"60","lineNumber":12,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":2}"}}],"this":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":3}"}},{"callFrameId":"{\"ordinal\":1,\"injectedScriptId\":1}","functionName":"Module._compile","functionLocation":{"scriptId":"46","lineNumber":525,"columnNumber":36},"location":{"scriptId":"46","lineNumber":565,"columnNumber":13},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":4}"},"name":"Module._compile","startLocation":{"scriptId":"46","lineNumber":525,"columnNumber":36},"endLocation":{"scriptId":"46","lineNumber":573,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":5}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":6}"}}],"this":{"type":"object","className":"Module","description":"Module","objectId":"{\"injectedScriptId\":1,\"id\":7}"}},{"callFrameId":"{\"ordinal\":2,\"injectedScriptId\":1}","functionName":"Module._extensions..js","functionLocation":{"scriptId":"46","lineNumber":577,"columnNumber":36},"location":{"scriptId":"46","lineNumber":579,"columnNumber":9},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":8}"},"name":"Module._extensions..js","startLocation":{"scriptId":"46","lineNumber":577,"columnNumber":36},"endLocation":{"scriptId":"46","lineNumber":580,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":9}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":10}"}}],"this":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":11}"}},{"callFrameId":"{\"ordinal\":3,\"injectedScriptId\":1}","functionName":"Module.load","functionLocation":{"scriptId":"46","lineNumber":493,"columnNumber":32},"location":{"scriptId":"46","lineNumber":502,"columnNumber":31},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":12}"},"name":"Module.load","startLocation":{"scriptId":"46","lineNumber":493,"columnNumber":32},"endLocation":{"scriptId":"46","lineNumber":504,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":13}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":14}"}}],"this":{"type":"object","className":"Module","description":"Module","objectId":"{\"injectedScriptId\":1,\"id\":15}"}},{"callFrameId":"{\"ordinal\":4,\"injectedScriptId\":1}","functionName":"tryModuleLoad","functionLocation":{"scriptId":"46","lineNumber":462,"columnNumber":22},"location":{"scriptId":"46","lineNumber":465,"columnNumber":11},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":16}"},"name":"tryModuleLoad","startLocation":{"scriptId":"46","lineNumber":462,"columnNumber":22},"endLocation":{"scriptId":"46","lineNumber":472,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":17}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":18}"}}],"this":{"type":"undefined"}},{"callFrameId":"{\"ordinal\":5,\"injectedScriptId\":1}","functionName":"Module._load","functionLocation":{"scriptId":"46","lineNumber":431,"columnNumber":23},"location":{"scriptId":"46","lineNumber":457,"columnNumber":2},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":19}"},"name":"Module._load","startLocation":{"scriptId":"46","lineNumber":431,"columnNumber":23},"endLocation":{"scriptId":"46","lineNumber":460,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":20}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":21}"}}],"this":{"type":"function","className":"Function","description":"function Module(id, parent) {\n this.id = id;\n this.exports = {};\n this.parent = parent;\n if (parent && parent.children) {\n parent.children.push(this);\n }\n\n this.filename = null;\n this.loaded = false;\n this.children = [];\n}","objectId":"{\"injectedScriptId\":1,\"id\":22}"}},{"callFrameId":"{\"ordinal\":6,\"injectedScriptId\":1}","functionName":"Module.runMain","functionLocation":{"scriptId":"46","lineNumber":602,"columnNumber":25},"location":{"scriptId":"46","lineNumber":604,"columnNumber":9},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":23}"},"name":"Module.runMain","startLocation":{"scriptId":"46","lineNumber":602,"columnNumber":25},"endLocation":{"scriptId":"46","lineNumber":607,"columnNumber":1}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":24}"},"startLocation":{"scriptId":"46","lineNumber":0,"columnNumber":10},"endLocation":{"scriptId":"46","lineNumber":672,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":25}"}}],"this":{"type":"function","className":"Function","description":"function Module(id, parent) {\n this.id = id;\n this.exports = {};\n this.parent = parent;\n if (parent && parent.children) {\n parent.children.push(this);\n }\n\n this.filename = null;\n this.loaded = false;\n this.children = [];\n}","objectId":"{\"injectedScriptId\":1,\"id\":26}"}},{"callFrameId":"{\"ordinal\":7,\"injectedScriptId\":1}","functionName":"startup","functionLocation":{"scriptId":"26","lineNumber":11,"columnNumber":18},"location":{"scriptId":"26","lineNumber":157,"columnNumber":15},"scopeChain":[{"type":"block","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":27}"},"name":"startup","startLocation":{"scriptId":"26","lineNumber":139,"columnNumber":61},"endLocation":{"scriptId":"26","lineNumber":158,"columnNumber":7}},{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":28}"},"name":"startup","startLocation":{"scriptId":"26","lineNumber":11,"columnNumber":18},"endLocation":{"scriptId":"26","lineNumber":203,"columnNumber":3}},{"type":"closure","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":29}"},"startLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"endLocation":{"scriptId":"26","lineNumber":575,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":30}"}}],"this":{"type":"undefined"}},{"callFrameId":"{\"ordinal\":8,\"injectedScriptId\":1}","functionName":"","functionLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"location":{"scriptId":"26","lineNumber":574,"columnNumber":2},"scopeChain":[{"type":"local","object":{"type":"object","className":"Object","description":"Object","objectId":"{\"injectedScriptId\":1,\"id\":31}"},"startLocation":{"scriptId":"26","lineNumber":9,"columnNumber":9},"endLocation":{"scriptId":"26","lineNumber":575,"columnNumber":1}},{"type":"global","object":{"type":"object","className":"global","description":"global","objectId":"{\"injectedScriptId\":1,\"id\":32}"}}],"this":{"type":"object","subtype":"null","value":null}}],"reason":"Break on start","hitBreakpoints":[]}}
Paused on entry
โ To target: "{\"id\":9,\"method\":\"Runtime.evaluate\",\"params\":{\"expression\":\"[process.pid, process.version, process.arch]\",\"returnByValue\":true,\"contextId\":1}}"
โ To target: "{\"id\":10,\"method\":\"Runtime.evaluate\",\"params\":{\"expression\":\"[process.pid, process.version, process.arch]\",\"returnByValue\":true,\"contextId\":1}}"
To client: {"seq":0,"type":"response","request_seq":2,"command":"attach","success":true}
โ From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"62","url":"","startLine":0,"startColumn":0,"endLine":0,"endColumn":44,"executionContextId":1,"hash":"22960EE2CC885872F71ED2E747A68B200282CC65","isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":false}}
โ From target: {"id":9,"result":{"result":{"type":"object","value":[60,"v8.1.2","x64"]}}}
Target node version: v8.1.2 x64
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"nodeVersion","data":{"version":"v8.1.2"}}}
SourceMaps: expanded globs and found 398 scripts
From client: loadedSources(undefined)
โ From target: {"method":"Debugger.scriptParsed","params":{"scriptId":"63","url":"","startLine":0,"startColumn":0,"endLine":0,"endColumn":44,"executionContextId":1,"hash":"22960EE2CC885872F71ED2E747A68B200282CC65","isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":false}}
โ From target: {"id":10,"result":{"result":{"type":"object","value":[60,"v8.1.2","x64"]}}}
To client: {"seq":0,"type":"response","request_seq":3,"command":"loadedSources","success":true,"body":{"sources":[{"name":"cli.js","path":"/opt/project/.build/compiled/cli.js","sourceReference":1034,"origin":"read-only content from Node.js"},{"name":"VM62","path":"<eval>/VM62","sourceReference":1035,"origin":"read-only content from Node.js"},{"name":"_stream_duplex.js","path":"<node_internals>/_stream_duplex.js","sourceReference":1030,"origin":"read-only core module"},{"name":"_stream_passthrough.js","path":"<node_internals>/_stream_passthrough.js","sourceReference":1032,"origin":"read-only core module"},{"name":"_stream_readable.js","path":"<node_internals>/_stream_readable.js","sourceReference":1026,"origin":"read-only core module"},{"name":"_stream_transform.js","path":"<node_internals>/_stream_transform.js","sourceReference":1031,"origin":"read-only core module"},{"name":"_stream_writable.js","path":"<node_internals>/_stream_writable.js","sourceReference":1029,"origin":"read-only core module"},{"name":"assert.js","path":"<node_internals>/assert.js","sourceReference":1010,"origin":"read-only core module"},{"name":"async_hooks.js","path":"<node_internals>/async_hooks.js","sourceReference":1009,"origin":"read-only core module"},{"name":"bootstrap_node.js","path":"<node_internals>/bootstrap_node.js","sourceReference":1000,"origin":"read-only core module"},{"name":"buffer.js","path":"<node_internals>/buffer.js","sourceReference":1003,"origin":"read-only core module"},{"name":"events.js","path":"<node_internals>/events.js","sourceReference":1001,"origin":"read-only core module"},{"name":"fs.js","path":"<node_internals>/fs.js","sourceReference":1023,"origin":"read-only core module"},{"name":"buffer.js","path":"<node_internals>/internal/buffer.js","sourceReference":1006,"origin":"read-only core module"},{"name":"errors.js","path":"<node_internals>/internal/errors.js","sourceReference":1005,"origin":"read-only core module"},{"name":"fs.js","path":"<node_internals>/internal/fs.js","sourceReference":1033,"origin":"read-only core module"},{"name":"linkedlist.js","path":"<node_internals>/internal/linkedlist.js","sourceReference":1008,"origin":"read-only core module"},{"name":"module.js","path":"<node_internals>/internal/module.js","sourceReference":1021,"origin":"read-only core module"},{"name":"process.js","path":"<node_internals>/internal/process.js","sourceReference":1011,"origin":"read-only core module"},{"name":"next_tick.js","path":"<node_internals>/internal/process/next_tick.js","sourceReference":1013,"origin":"read-only core module"},{"name":"promises.js","path":"<node_internals>/internal/process/promises.js","sourceReference":1014,"origin":"read-only core module"},{"name":"stdio.js","path":"<node_internals>/internal/process/stdio.js","sourceReference":1015,"origin":"read-only core module"},{"name":"warning.js","path":"<node_internals>/internal/process/warning.js","sourceReference":1012,"origin":"read-only core module"},{"name":"querystring.js","path":"<node_internals>/internal/querystring.js","sourceReference":1017,"origin":"read-only core module"},{"name":"BufferList.js","path":"<node_internals>/internal/streams/BufferList.js","sourceReference":1027,"origin":"read-only core module"},{"name":"destroy.js","path":"<node_internals>/internal/streams/destroy.js","sourceReference":1028,"origin":"read-only core module"},{"name":"legacy.js","path":"<node_internals>/internal/streams/legacy.js","sourceReference":1025,"origin":"read-only core module"},{"name":"url.js","path":"<node_internals>/internal/url.js","sourceReference":1016,"origin":"read-only core module"},{"name":"util.js","path":"<node_internals>/internal/util.js","sourceReference":1004,"origin":"read-only core module"},{"name":"module.js","path":"<node_internals>/module.js","sourceReference":1020,"origin":"read-only core module"},{"name":"path.js","path":"<node_internals>/path.js","sourceReference":1019,"origin":"read-only core module"},{"name":"querystring.js","path":"<node_internals>/querystring.js","sourceReference":1018,"origin":"read-only core module"},{"name":"stream.js","path":"<node_internals>/stream.js","sourceReference":1024,"origin":"read-only core module"},{"name":"timers.js","path":"<node_internals>/timers.js","sourceReference":1007,"origin":"read-only core module"},{"name":"util.js","path":"<node_internals>/util.js","sourceReference":1002,"origin":"read-only core module"},{"name":"vm.js","path":"<node_internals>/vm.js","sourceReference":1022,"origin":"read-only core module"}]}}
SourceMap: creating for /home/sfomin/projects/app/.build/compiled/cli.js
SourceMap: sourceRoot: undefined
SourceMap: sources: ["cli.ts"]
SourceMap: no sourceRoot specified, using script dirname: /home/sfomin/projects/app/.build/compiled
SourceMaps.scriptParsed: /home/sfomin/projects/app/.build/compiled/cli.js was just loaded and has mapped sources: ["/home/sfomin/projects/app/.build/compiled/cli.ts"]
If I place breakpoints inside of transpiled JS files (in /.build/compiled directory), opened in the editor, they are working fine. I guess it means that localRoot and remoteRoot options are configured correctly. However, breakpoints in source files are just ignored.
How do I make it to work? I think I'm missing something trivial here.
Any suggestions will be highly appreciated! Thank you!
also happens for me, when my launch.json looks like:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"port": 9229,
"address": "localhost",
"restart": true,
"protocol": "inspector",
"remoteRoot": null,
"sourceMaps": true,
"localRoot": "${workspaceRoot}/"
}
]
}
I'm running nodemon with babel-node. When I put a debugger, it opens a new file (with the precompiled ES6 as expected) with this title:

but breakpoints are being completely ignored.
any help?
@lironess since you are leaving the "remoteRoot" undefined, your setup is no remote setup.
Please create a new issue.
@slavafomin did you ever figure this out? I have the same issue in the latest stable version 1.21.1
With the appearance of the VS Code Remote Development Pack this problem has become obsolete.
Most helpful comment
Hello there!
I'm having a very hard time trying to setup remote debugging as well.
I have a Node.js application written in TypeScript. I'm using Docker container to transpile and run the application in development environment. I've managed to expose the port and to connect to it with the IDE. However, I can't make breakpoints to work from source TypeScript files. They are just turning grey when I connect to the running app.
/home/sfomin/projects/app,./src,./.build/compiled,/opt/project, the relative directories are the same,node --inspect-brk=0.0.0.0:9229 ./.build/compiled/cli.js.My
launch.jsonlooks like this:Here's example source map file:
It's referenced like this from the transpiled file:
//# sourceMappingURL=cli.js.map.And here's the part of the debug trace log:
If I place breakpoints inside of transpiled JS files (in
/.build/compileddirectory), opened in the editor, they are working fine. I guess it means thatlocalRootandremoteRootoptions are configured correctly. However, breakpoints in source files are just ignored.How do I make it to work? I think I'm missing something trivial here.
Any suggestions will be highly appreciated! Thank you!