在VSCode上调试Node.js时找不到模块app.js

时间:2020-10-30 13:06:08

标签: node.js visual-studio-code vscode-debugger

我用VScode创建了一个Nodejs,当我想调试该应用程序时遇到了上述问题。

问题:

Error: Cannot find module 'f:\xxx\MyNodeJS\app.js'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3

我已设置为使用index.js

下面是package.json

{
  "name": "mynodejs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "jquery": "^3.5.1",
    "stripe": "^8.60.0"
  }
}

更新:

{
    "configurations": [
    {
        "name": "Launch Program",
        "program": "${workspaceFolder}/app.js",
        "request": "launch",
        "skipFiles": [
            "<node_internals>/**"
        ],
        "type": "pwa-node"
    }
    ]
}

我需要做什么?非常感谢您的帮助。谢谢

0 个答案:

没有答案