启动配置
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/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}"
}
]
}
字符串
在Visual Studio代码中调试我的React代码时,我得到以下错误。实际上,我已经用node+react创建了这个项目,并使用visual studio作为IDE,并希望调试我的代码。我已经尝试了很多,但不能成功地调试我的代码。
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._compile (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)
型
6条答案
按热度按时间nhaq1z211#
我通过在我想要调试的函数中添加以下代码来解决它:
字符串
并开始调试。编码快乐!!
ztigrdn82#
对我来说,只有将cwd设置为
第一个月
nue99wik3#
非常简单的解决方案是->只需卸载调试器并删除launch.json文件,然后重新安装调试器,然后启动
j2datikz4#
要在没有launch.json的情况下在vs代码中开始调试,请执行以下操作:
后藤文件”→“首选项”→“设置”→“扩展”→“节点调试”→[选择]“打开”
的数据
r8xiu3jd5#
我遇到了同样的问题,原来线索在控制台:检测到Node.js v6.10.2,使用旧协议调试。
我使用以下步骤解决了它:
npm install
放置断点并重试。
k4ymrczo6#
我从.net core 3. 1升级到.net core 6,调试没有拿起我的新控制器方法。我必须将configurations下的launch.json程序关键字更新到正确的位置。我将Debug和Controllers.dll之间的值从netcoreapp3.1更改为net6.0
