VSC。调试器断开连接,此外断点不同步。为什么?

问题描述 投票:0回答:1

我使用node和next 14.1,操作系统是ubuntu 22.04

我一直在使用

npx nx run inspec:serve:development
命令运行本地主机。它按预期工作。

最近,我想调试一些东西,所以我用谷歌搜索了一段时间,并为我的 launch.json 构建了这个配置,显然是根据我的东西名称调整了它

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "app-name",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "npx",
      "runtimeArgs": [
        "nx",
        "run",
        "app-name:serve",
        "-r",
        "ts-node/register",
        "-r",
        "tsconfig-paths/register"
      ],
      "outputCapture": "std",
      "internalConsoleOptions": "openOnSessionStart",
      "console": "internalConsole",
      "env": {
        "TS_NODE_IGNORE": "false",
        "TS_NODE_PROJECT": "${workspaceFolder}/app-name/tsconfig.json"
      },
      "cwd": "${workspaceFolder}"
    }
  ]
}

我不太确定它是否正确,它启动我的环境并捕获异常并显示日志,所以我认为这很好。 问题是,调试器每次连接时都会在给出任何反馈之前断开连接。 Debugger getting disconected... 有趣的是,它能够调试异常。如果我选中“未捕获/捕获异常”复选框,它就会同步。 Exception is debugging 我还尝试通过 javascript 调试控制台直接启动启动命令(npx nx...)。以相同的结果结束,但输出更长。

这是日志。

Debugger attached. Debugger attached. nx run app-name:serve:development Debugger attached. Debugger attached. Debugger attached. ▲ Next.js 14.1.0 - Local: http://localhost:4200 - Environments: .env.local Debugger attached. Waiting for the debugger to disconnect... ✓ Ready in 38.3s ○ Compiling /api/auth/[...nextauth] ... ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx Debugger attached. Waiting for the debugger to disconnect... ⨯ ../node_modules/ol/Map.js (366:21) @ document ⨯ Internal error: ReferenceError: document is not defined at new Map (../node_modules/ol/Map.js:326:26) at new RMap (../node_modules/rlayers/dist/RMap.js:32:19) at (...) null { error: 'invalid_grant', error_description: 'Refresh token expired' } ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx **Debugger attached.** { error: 'invalid_grant', error_description: 'Refresh token expired' } ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx { error: 'invalid_grant', error_description: 'Refresh token expired' } **Waiting for the debugger to disconnect... ** ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx { error: 'invalid_grant', error_description: 'Refresh token expired' } { error: 'invalid_grant', error_description: 'Refresh token expired' } ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx ⚠ ../node_modules/web-worker/node.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ../node_modules/web-worker/node.js ../node_modules/geotiff/dist-module/worker/decoder.js ../node_modules/geotiff/dist-module/pool.js ../node_modules/geotiff/dist-module/geotiff.js ../node_modules/ol/source/GeoTIFF.js ../node_modules/ol/source.js ../common/components/map/openlayers/OpenLayers.tsx ../common/components/map/clientMap.tsx chatrooms [ Chatroom { chatroom_id: 1, chatroom_name: 'Test1', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 2, chatroom_name: 'Test2', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 3, chatroom_name: 'NombreLargoTest1', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 4, chatroom_name: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', chatroom_users: { users: [Array] } } ] chatrooms [ Chatroom { chatroom_id: 1, chatroom_name: 'Test1', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 2, chatroom_name: 'Test2', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 3, chatroom_name: 'NombreLargoTest1', chatroom_users: { users: [Array] } }, Chatroom { chatroom_id: 4, chatroom_name: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', chatroom_users: { users: [Array] } } ]

是的,有很多例外,但正如你所看到的,当我戳东西时,我会收到控制台日志。

我让我的一个朋友运行代码,他

能够通过 Windows 上的 VSC Javascript 调试控制台来完成它

,所以我怀疑这是 Ubuntu 所做的。 你们能给我一些线索吗?

我已授予 vscode 文件权限作为本主题的答案(以防万一缺少一些)

text

我尝试了不同的 launch.json 配置并得到了类似的输出。无法链接这些内容,因为它们来自不同的主题。 还尝试在project.json和launch.json中启用sourceMap属性

我想知道我是否遗漏了任何明显的东西,不知道我还能尝试什么。

(以防万一,我已经检查过这个问题是否已经在其他地方解决)

javascript visual-studio-code debugging next.js launch
1个回答
0
投票
chown user:user -hR .

后,调试器开始正常工作;_;

    

© www.soinside.com 2019 - 2024. All rights reserved.