Anatoly Strashkevich
Anatoly Strashkevich

Reputation: 1914

vscode Debugger Cannot find module

I copypaste launch.json from different project into vscode folder in project folder and substitute paths to files. When i start debugger i got the following error:

Error: Cannot find module 'c:\Users\Anatoly\Desktop\project_folder --inspect=34947' at Module._resolveFilename (module.js:470:15)

Could you please point out to me what may be the reason for such an error? Thank you!

This is launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {   
      "name": "Debug Main Process",
      "type": "node",
      "request": "launch",
      "program": "${workspaceRoot}/app/main.ts",
      "stopOnEntry": false,
      "args": ["."],  
      "cwd": "${workspaceRoot}",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
      "outFiles": [  
        "${workspaceRoot}/dist/main.js" 
      ],
      "protocol":"inspector",
      "env": { }, 
      "sourceMaps": true 
    }   
  ]
} 

Upvotes: 19

Views: 12399

Answers (2)

mrbinky3000
mrbinky3000

Reputation: 4291

I ran into this error myself. In my case, I had simply forgotten to run npm install to install all the project's dependencies before trying to debug the program. Silly error on my part.

Upvotes: 4

Parker Lindley
Parker Lindley

Reputation: 104

I think your program is using the root when when should be using folder. Try ${workspaceFolder}/app/main.ts rather than ${workspaceRoot}.

Upvotes: 2

Related Questions