更新了最新的vscode,发现打断点的时候总是报错。报错信息如下
Error processing "breakpointLocations": TypeError: Cannot read property 'line' of undefined
at breakpoints.forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/out/src/transformers/baseSourceMapTransformer.js:156:55)
at Array.forEach (<anonymous>)
at EagerSourceMapTransformer.setBreakpointsResponse (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/out/src/transformers/baseSourceMapTransformer.js:147:29)
at NodeBreakpoints.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/out/src/chrome/breakpoints.js:309:69)
at Generator.next (<anonymous>)
at fulfilled (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/out/src/chrome/breakpoints.js:7:58)
找了一下官方的github,只需要修改下面的代码即可,估计晚点vscode出新版本就不会再有问题,急的话可以按照下面思路修复:
找到文件
E:\Microsoft\VSCode\resources\app\extensions\ms-vscode.node-debug2\node_modules\vscode-chrome-debug-core\out\src\transformers\baseSourceMapTransformer.js
修改156行的
//原版
vscode_debugadapter_1.logger.log(`SourceMaps.setBP: Can't map ${args.generatedPath}:${bp.line + 1}:${bp.column + 1}, keeping original line numbers.`);
bp.line = args.originalBPs[i].line;
bp.column = args.originalBPs[i].column;
//修改后
vscode_debugadapter_1.logger.log(`SourceMaps.setBP: Can't map ${args.generatedPath}:${bp.line + 1}:${bp.column + 1}, keeping original line numbers.`);
if (args.originalBPs[i]) {
bp.line = args.originalBPs[i].line;
bp.column = args.originalBPs[i].column;
}
修改后再次调试debug就不会再报错。
网友评论