express-generator-typescript生成的捆绑包无法成功运行调试器

我正在使用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是默认软件包。我没有更改新创建的文件夹中的任何内容。

谢谢。

bcy63997863 回答:express-generator-typescript生成的捆绑包无法成功运行调试器

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

,

让您在vs代码的launch.json文件中添加"-r","tsconfig-paths/register",

"configurations": [
    {
        "type": "node","request": "launch","name": "Debug Dev Env","runtimeArgs": [
            "-r","ts-node/register","-r",],"args": [
            "${workspaceFolder:PhotonSuite}/src/index.ts"
        ],"protocol": "inspector"
    },
本文链接:https://www.f2er.com/3168438.html

大家都在问