【问题标题】:express-generator-typescript generated bundle is not able to run debugger successfullyexpress-generator-typescript 生成的包无法成功运行调试器
【发布时间】:2020-02-29 12:10:47
【问题描述】:

我正在使用 express-generator-typescript(1.4.2) 生成一个类型脚本项目。现在我想将 Visual Studio 调试器应用于这个新创建的包,但我无法做到。我收到错误消息。

/usr/bin/node --inspect-brk=15587 dist/src/Server.js 
Debugger listening on ws://127.0.0.1:15587/552eb586-a9ba-49ec-8fae-2a8834625bd4
Debugger attached.
module.js:550
    throw err;
    ^

Error: Cannot find module '@daos'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/pankaj/express-gen-ts/dist/src/routes/Users.js:4:17)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
Waiting for the debugger to disconnect...

@daos 是一个默认包。我没有更改新创建的文件夹中的任何内容。

提前致谢。

【问题讨论】:

    标签: node.js typescript visual-studio npm


    【解决方案1】:

    似乎您正在尝试使用别名而不导入模块。尝试在您的起始文件中要求“模块别名/注册”。

    【讨论】:

      【解决方案2】:

      让你在你的 vs-code launch.json 文件中包含"-r", "tsconfig-paths/register",

      "configurations": [
          {
              "type": "node",
              "request": "launch",
              "name": "Debug Dev Env",
              "runtimeArgs": [
                  "-r", "ts-node/register",
                  "-r", "tsconfig-paths/register",
              ],
              "args": [
                  "${workspaceFolder:PhotonSuite}/src/index.ts"
              ],
              "protocol": "inspector"
          },
      

      【讨论】:

        猜你喜欢
        • 2017-08-16
        • 2020-07-01
        • 2022-06-27
        • 2014-04-10
        • 1970-01-01
        • 2017-04-04
        • 1970-01-01
        • 2022-01-16
        • 2016-01-18
        相关资源
        最近更新 更多