node.js - VSCode 不会关闭子进程 (processChild.js)
问题描述
我刚刚注意到,在关闭调试器后,VSCode 并没有按应有的方式关闭 Node.js 子进程。在调试器启动/停止 5-10 次后,这些进程开始严重占用我的内存。
我正在使用最新的 LTS nodejs 来管理NVM。
我不知道我的调试器配置或 VSCode 错误是否有问题,但这是我的配置;
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via yarn",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "yarn",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Node Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch firefox",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack://_n_e/pages/news",
"path": "${workspaceFolder}/pages/news"
},
{
"url": "webpack://_n_e/client/index.tsx",
"path": "${workspaceFolder}/pages/news/index.tsx"
},
{
"url": "webpack://_n_e/pages/haberler",
"path": "${workspaceFolder}/pages/haberler"
},
{
"url": "webpack://_n_e/components",
"path": "${workspaceFolder}/components"
}
]
}
],
"compounds": [
{
"name": "Combined debugger",
"configurations": ["Launch via yarn", "Node Attach", "Launch firefox"]
}
]
}
解决方案
我发现只有在Launch via yarn
关闭之前关闭才会出现问题Node Attach
。
为了防止关闭顺序出现错误,我删除了Node Attach
支持自动附加功能的配置。
这是我的配置的最新版本,供需要的人使用;
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch via yarn",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "yarn",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
"console": "integratedTerminal"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Launch firefox",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"pathMappings": [
{
"url": "webpack://_n_e/client/index.tsx",
"path": "${workspaceFolder}/pages/index.tsx"
},
{
"url": "webpack://_n_e/components",
"path": "${workspaceFolder}/components"
}
]
}
],
"compounds": [
{
"name": "Combined debugger",
"configurations": ["Launch via yarn", "Launch firefox"]
}
]
}
推荐阅读
- powershell - 尝试使用 Sharepoint Online 电源 shell 命令时出错
- python - 如何在 urls.py 中为此创建正则表达式?
- html - 如何在 macOS Safari 中使用预加载的字体?
- html - RTC 样式被 Css 覆盖
- splunk - 如何在 Splunk 中生成包含多个数据系列的可视化
- firebase - 对console.log上显示的本机数据做出反应,但不在屏幕上
- javascript - 将两个组件定位为列
- mysql - 用户代理和 IP 地址哈希作为 Mysql 中的主键加入
- quickfixj - 通过 QuickFIX/J 使用自己的 TCP 层实现
- kubernetes - Minio Tenant 只是停留在“等待 Pod 准备就绪”,但 pod 的状态是 Running