Launch Configuration
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: /?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 5858
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/src/app.js",
"cwd": "${workspaceRoot}"
}
]
}
I am getting the following error while debugging my react code in visual studio code. Actually I have created the project with node+react and use visual studio as IDE and want to debug my code. I have tried a lot but not able to success to debug my code.
Debugging with legacy protocol because Node.js v6.10.2 was detected.Program path uses differently cased character as file on disk; this might result in breakpoints not being hit.
node --debug-brk=21730 --nolazy src\app.js
Debugger listening on [::]:21730
e:\reactjs\reactFacebook\my-app\src\app.js:1
(function (exports, require, module, __filename, __dirname) { import React, { Component } from 'react';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._pile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
at ontimeout (timers.js:380:14)
at tryOnTimeout (timers.js:244:5)
Launch Configuration
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft./fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 5858
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/src/app.js",
"cwd": "${workspaceRoot}"
}
]
}
I am getting the following error while debugging my react code in visual studio code. Actually I have created the project with node+react and use visual studio as IDE and want to debug my code. I have tried a lot but not able to success to debug my code.
Debugging with legacy protocol because Node.js v6.10.2 was detected.Program path uses differently cased character as file on disk; this might result in breakpoints not being hit.
node --debug-brk=21730 --nolazy src\app.js
Debugger listening on [::]:21730
e:\reactjs\reactFacebook\my-app\src\app.js:1
(function (exports, require, module, __filename, __dirname) { import React, { Component } from 'react';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._pile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Timeout.Module.runMain [as _onTimeout] (module.js:604:10)
at ontimeout (timers.js:380:14)
at tryOnTimeout (timers.js:244:5)
Share
Improve this question
edited Jun 15, 2017 at 6:38
putu
6,4541 gold badge22 silver badges31 bronze badges
asked Jun 15, 2017 at 2:44
Himanshu PandeyHimanshu Pandey
111 gold badge1 silver badge3 bronze badges
1
-
Probably related to VS Code issue #24764. As mentioned in the issue, try add
"protocol": "inspector"
in yourlaunch.json
. – putu Commented Jun 15, 2017 at 6:46
6 Answers
Reset to default 3I resolved it by adding below code inside the function which I want to debug:
debugger;
and debugging started. Happy coding!!
For me, debugging is only possible with cwd set to
"cwd": "${workspaceRoot}/src"
Very simple solution is -> just uninstall debugger and delete launch.json file After that reinstall debugger then start
To start debugging in vs code without launch.json,
Goto File → Preferences → Settings → Extensions → Node Debug →[select ] "ON"
I had the same issue, turns out the clue was in the console: Debugging with legacy protocol because Node.js v6.10.2 was detected.
I resolved it using the following steps:
- Shutdown VS Code
- Uninstall node
- Install node v5 using NVM
- Delete node_modules folder in project
- Re-open VS Code
- Run
npm install
Place a breakpoint and try again.
I upgraded from core 3.1 to core 6 and debugging was not picking up my new controller methods. I had to update my launch.json program keyword under configurations to the correct location. I changed the value between Debug and Controllers.dll from netcoreapp3.1 to net6.0