node.js Visual Studio 代码 - 10000 毫秒后无法连接到运行时进程超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50083113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio code - cannot connect to runtime process timeout after 10000 ms
提问by jdotdoe
I was trying to launch the program from the debug console in VS Code but got the error on cannot connect to runtime process timeout after 10000 ms
我试图从 VS Code 中的调试控制台启动程序,但出现错误 cannot connect to runtime process timeout after 10000 ms
launch.json
启动文件
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
},
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach",
"port": 9229
},
{
"type": "node",
"request": "launch",
"port":9230,
"name": "Launch Program",
"program": "${workspaceFolder}\bin\www"
}
]
}
I am trying to debug with VS Code but got hit by the error as below. Am I configuring my launch.json correctly ?
我正在尝试使用 VS Code 进行调试,但遇到如下错误。我是否正确配置了我的launch.json?
采纳答案by Rob Lourens
A "launch"-type configuration doesn't need to specify a port. When you set the portparameter, it assumes that your launch config will include the --inspect parameter with that port.
“启动”类型的配置不需要指定端口。当您设置该port参数时,它假定您的启动配置将包含该端口的 --inspect 参数。
If you have to specify the exact port for some reason, then you can include the --inspect parameter like:
如果出于某种原因必须指定确切的端口,则可以包含 --inspect 参数,例如:
{
"type": "node",
"request": "launch",
"port":9230,
"runtimeArgs": ["--inspect=9230"],
"name": "Launch Program",
"program": "${workspaceFolder}\bin\www"
}
But I recommend just removing "port" from your launch config.
但我建议只从您的启动配置中删除“端口”。
回答by jarederaj
I'm using nodemon and babel to start visual studio code and found that you need to make sure you have a configuration in package.json and launch.json that are compatible with visual studio code.
我正在使用 nodemon 和 babel 启动 Visual Studio 代码,发现需要确保 package.json 和 launch.json 中有一个与 Visual Studio 代码兼容的配置。
Really, that means that you need to find a configuration that allows you to launch your regular configuration from powershell as well as gitbash in windows. Here's what I came up with:
真的,这意味着您需要找到一个配置,允许您从 Windows 中的 powershell 和 gitbash 启动常规配置。这是我想出的:
In package.json
在 package.json 中
"scripts": {
"start": "nodemon --inspect --exec babel-node -- index.js",
},
In launch.json
在launch.json
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Launch via Babel (works)",
"cwd": "${workspaceRoot}",
"port": 9229,
"program": "",
"runtimeExecutable": "npm",
"console": "integratedTerminal",
"runtimeArgs": [
"start"
]
}
]
}
When node starts you should see something like:
当节点启动时,您应该看到如下内容:
PS F:\noise\bookworm-api> cd 'F:\noise\bookworm-api'; & 'F:\applications\nodejs\npm.cmd' 'start'
> [email protected] start F:\noise\bookworm-api
> nodemon --inspect --exec babel-node -- index.js
[nodemon] 1.18.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node --inspect index.js`
Debugger listening on ws://127.0.0.1:9229/e6e1ee3c-9b55-462e-b6db-4cf67221245e
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
Running on localhost:3333
The thing you're really looking for is:
你真正要找的是:
Debugger listening on ws://127.0.0.1:9229/e6e1ee3c-9b55-462e-b6db-4cf67221245e
This output shows that your debugger is waiting on a WebSockets request on port 9229. You communicate that to visual studio code with:
此输出显示您的调试器正在等待端口 9229 上的 WebSockets 请求。您将其传达给 Visual Studio 代码:
"port": 9229,
In your launch.json file.
在您的 launch.json 文件中。
If you don't see the port that the debugging server is waiting on then you probably need to add the --inspectflag to your start command in node.
如果您没有看到调试服务器正在等待的端口,那么您可能需要将该--inspect标志添加到node.js 中的启动命令中。
回答by cdonner
I get this same error when I forget to close the browser from the last debug session. It holds on to the connection to the Angular proxy and prevents a new debug session from starting up. Once I close the browser, F5 starts up a new session without error.

当我忘记从上次调试会话中关闭浏览器时,我收到了同样的错误。它保持与 Angular 代理的连接并阻止新的调试会话启动。关闭浏览器后,F5 将启动一个新会话而不会出错。

回答by rafael cast
Open Android Studio, Configure, ADV Manager, create or open an ADV. In VS Code and in debug click emulate android cordova
打开 Android Studio,配置,ADV 管理器,创建或打开一个 ADV。在 VS Code 和调试中单击 emulate android cordova
Command line - cordova emulate android
命令行 - cordova 模拟 android
{
"name": "cordova emulate android",
"type": "cordova",
"request": "launch",
"platform": "android",
"target": "emulator",
"port": 9222,
"sourceMaps": true,
"cwd": "${workspaceRoot}",
// "ionicLiveReload": true
},
回答by u5819157
duplicate
Google Chromeshortcut →itestpress
altkey doubleclickitestitest Properties→ Shortcut→ Target:
复制
Google Chrome快捷方式 →itest按
alt键双击itestitest 属性→快捷方式→目标:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=6062 --user-data-dir="%appdata%\Google\Chrome\itest
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=6062 --user-data-dir="%appdata%\Google\Chrome\itest
- VS Code, Menu Debug→ Add Configuration→ Chrome: Attach→
"port": 6062,→Ctrl+Shift+DDebug → Switch Attach to Chrome→ Start Debugging
- VS Code,菜单Debug→ Add Configuration→ Chrome: Attach→
"port": 6062,→Ctrl+Shift+DDebug → Switch Attach to Chrome→ Start Debugging
回答by ravi
In my case updating the core tools solved the issue.
在我的情况下,更新核心工具解决了这个问题。
Use the below command to update:
使用以下命令进行更新:
npm install -g azure-functions-core-tools
回答by Manish Dubey
Delete launch.json file and go to debug and create new launch.json file
删除launch.json文件并去调试并创建新的launch.json文件
回答by teja teja
Go to Tools -> Options -> Debugging -> Generalthen disable
I'm using it successfully with the following options disabled.
转到Tools -> Options -> Debugging -> General然后禁用我在禁用以下选项的情况下成功使用它。
In Visual Studio go to: Tools -> Options -> Debugging -> General
在 Visual Studio 中转到: Tools -> Options -> Debugging -> General
Enable JavaScript debugging for Asp.Net (Chrome, Edge, and IE) Enable Legacy Chrome JavaScript debugger for ASP.NET.
为 Asp.Net(Chrome、Edge 和 IE)启用 JavaScript 调试 为 ASP.NET 启用旧版 Chrome JavaScript 调试器。

