无法在TypeScript-VS代码中调试
由于某些错误,我无法打开localhost,也无法在VS代码中调试TypeScript文件。我已在Chrome属性中将目标设置为无法在TypeScript-VS代码中调试,typescript,visual-studio-code,nativescript,vscode-debugger,Typescript,Visual Studio Code,Nativescript,Vscode Debugger,由于某些错误,我无法打开localhost,也无法在VS代码中调试TypeScript文件。我已在Chrome属性中将目标设置为“C:\Program Files(x86)\Google\Chrome\Application\Chrome.exe”“--远程调试端口=9222”。由于[debugger for chrome]无法连接到目标:connect EconRefuse127.0.0.1:9222,我收到了错误。请参阅下图,了解终止所有chrome.exe进程后出现的错误。有人能帮我解决这
“C:\Program Files(x86)\Google\Chrome\Application\Chrome.exe”“--远程调试端口=9222”
。由于[debugger for chrome]无法连接到目标:connect EconRefuse127.0.0.1:9222,我收到了错误。请参阅下图,了解终止所有chrome.exe
进程后出现的错误。有人能帮我解决这个问题吗?提前谢谢
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html with sourcemaps",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
var x = 1;
console.log(x); //made debugger here in VS Code
<!doctype html>
<html>
<body>
<h3>TypeScript Debugger</h3>
<script src="app/app.js"></script>
</body>
</html>
tsconfig.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html with sourcemaps",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
var x = 1;
console.log(x); //made debugger here in VS Code
<!doctype html>
<html>
<body>
<h3>TypeScript Debugger</h3>
<script src="app/app.js"></script>
</body>
</html>
app/app.ts:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html with sourcemaps",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
var x = 1;
console.log(x); //made debugger here in VS Code
<!doctype html>
<html>
<body>
<h3>TypeScript Debugger</h3>
<script src="app/app.js"></script>
</body>
</html>
index.html:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch index.html with sourcemaps",
"type": "chrome",
"request": "launch",
"file": "${workspaceRoot}/index.html",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
var x = 1;
console.log(x); //made debugger here in VS Code
<!doctype html>
<html>
<body>
<h3>TypeScript Debugger</h3>
<script src="app/app.js"></script>
</body>
</html>
类型脚本调试器
没有直接回答这个问题,但可能仍然有用:您知道可以在Chrome中直接调试typescript,包括断点吗?你甚至不需要安装插件。
请参见此屏幕截图:
尝试在任务管理器中关闭所有chrome.exe
进程,然后使用远程调试标志再次尝试启动。您可以将这些文本文件作为文本发布吗?如果有人想重新创建您的情况,他们必须重新键入所有代码。@Gideon我尝试过杀死所有chrome.exe进程。现在我得到了加载资源失败的:net::ERR\u连接被拒绝(http://localhost:3000/)“
您可以在我刚刚发布的这篇文章中引用的错误edited@MikeMcCaughan我编辑了这篇文章。这有意义吗?好得多,但请包含错误消息的文本。问题是图像是不可搜索的,所以人们试图通过搜索来找到它是不走运的。这很酷。但是如何在vs代码中调试nativescript js
project(适用于android和ios)?您能检查我的其他关于nativescript emulator的问题并给我一个解决方案吗?