How to debug NodeJS(ES6) code in VSCode editor?

前端 未结 1 1515
渐次进展
渐次进展 2021-02-05 16:51

I am trying to debug my nodejs application written in ES6 from VSCode. But it is throwing following error:

node --debug-brk=18712 --nolazy index.js 
Debugger li         


        
1条回答
  •  悲哀的现实
    2021-02-05 17:06

    You need to set runtimeExecutable in launch.json configuration file to the value of babel-node's path.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "node",
                "request": "launch",
                "name": "Launch via Babel",
                "program": "${workspaceRoot}/index.js",
                "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node",
                "cwd": "${workspaceRoot}"
            }
        ]
    }
    

    0 讨论(0)
提交回复
热议问题