相关疑难解决方法(0)

使用 VScode 启动配置在 Nx 中调试 NestJS 应用程序

在 VSCode 中,我尝试在调试模式下使用 Nx 启动 NestJS 应用程序。我目前正在使用 VSCode nightly js 调试器扩展。我不确定这里出了什么问题。我还尝试将类型“module”添加到 package.json 文件中,但这也不起作用。我还必须添加 TS_NODE_PROJECT 变量,因为如果没有它,我会收到一条错误消息,指出找不到 tsconfig.json 文件。我目前收到以下错误:

Users/user/Documents/angular_projects/nestwktest/apps/api/src/main.ts:5
import { __awaiter } from "tslib";
^^^^^^
node_modules/source-map-support/source-map-support.js:499

SyntaxError: Cannot use import statement outside a module
   at Module._compile (internal/modules/cjs/loader.js:891:18)
   at Module._compile 
(/Users/user/Documents/angular_projects/nestwktest/node_modules/ts- 
node/src/index.ts:1056:23)
at internal/modules/cjs/loader.js:991:10
at Object..ts (/Users/user/Documents/angular_projects/nestwktest/node_modules/ts-node/src/index.ts:1059:12)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function._load (internal/modules/cjs/loader.js:723:14)
at Function.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
Process exited with code 1
Run Code Online (Sandbox Code Playgroud)

这是我的 launch.json

"version": "0.2.0",
"configurations": [
    {
        "type": "pwa-node",
          "request": "launch",
          "name": "Debug Nest Framework",
          "args": [
              "${workspaceFolder}/apps/api/src/main.ts" …
Run Code Online (Sandbox Code Playgroud)

node.js typescript nestjs vscode-debugger nrwl-nx

5
推荐指数
1
解决办法
2518
查看次数

标签 统计

nestjs ×1

node.js ×1

nrwl-nx ×1

typescript ×1

vscode-debugger ×1