Answer a question

I'm developing on OSX and Windows. Everything was working fine over the weekend but at work, I'm confronted with the following error while running my debug config.

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '"/Applications/Visual'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:812:12)
    at preloadModules (internal/bootstrap/node.js:599:7)
    at startup (internal/bootstrap/node.js:273:9)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

Running npm run serve in the nested directory works fine so this leads me to believe I have misconfigured my launch.json. I've also tried reinstalling node, deleting my node_modules and package_lock.json

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "rpr-app",
            "request": "launch",
            "runtimeArgs": [
                "run-script",
                "serve"
            ],
            "runtimeExecutable": "npm",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "pwa-node",
            "cwd": "${workspaceFolder}/rpr-app",
            "outputCapture": "std",
            "serverReadyAction":{
                "action": "openExternally",
                "pattern": "App running at",
                "uriFormat": "http://localhost:8080"
            }
        },
        {
            "type": "node",
            "request": "launch",
            "name": "rpr-api",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run-script",
                "dev"
            ],
            "port": 9229,
            "skipFiles": [
                "<node_internals>/**"
            ],
            "envFile": "${workspaceFolder}/.env",
            "outputCapture": "std",
            "cwd":"${workspaceFolder}/rpr-api"
        }
    ],
    "compounds": [
        {
          "name": "Dev Server/Client",
          "configurations": ["rpr-api", "rpr-app"]
        //   "preLaunchTask": "${defaultBuildTask}"
        }
      ]
  }

Answers

I also started to have some problems with VS Code Debugger for JavaScript. To avoid the error you talk about, try setting runtimeExecutable: "node" instead of "npm". That should work but at the same time, at least in my case, I cannot set breakpoints anymore, and if you cannot set breakpoints, what sense does the debugger make?

Here is some info about the latest version and effectively the changed the debugger for JS: https://code.visualstudio.com/updates/v1_47#_new-javascript-debugger

You can download and use the previous version until some gentile soul brings the definitive solution

Hope it helps. Best regards, PR.

Logo

前往低代码交流专区

更多推荐