We're Hiring!

Mattermost, Inc.

Cannot debug main process of Desktop

Hi guys, I got a “Cannot find module package.json” error while trying to debug main process.
When I try an example from electronjs.org it works. npm start also runs mattermost-desktop.
I added a screenshot below.
My launch.json is as follows(I commented out prelaunchtask in order to save time,since I do not modify code right now.)

{
  "version": "0.2.0",
  "configurations": [
    
  
    
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Main Process",
      "cwd": "${workspaceRoot}",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
      "runtimeArgs": [
        "src",
        "--disable-dev-mode"
      ],
      "windows": {
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
      },
      "program": "${workspaceRoot}/src/main.js",
      "outFiles": [
        "${workspaceRoot}/src/main_bundle.js"
      ],
      "sourceMaps": true
      //"preLaunchTask": "Build sources"
    },
    
    {
      "name": "Debug Renderer Process",
      "type": "chrome",
      "request": "launch",
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
      "windows": {
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
      },
      "runtimeArgs": [
        "${workspaceRoot}/src",
        "--disable-dev-mode",
        // "--serve",
        // "--inspect-brk=5893"
        "--remote-debugging-port=9223"
      ],
      "webRoot": "${workspaceRoot}/src/browser",
      "sourceMaps": true
      //"preLaunchTask": "Build sources"
    }
    
    // {
    //   "type": "node",
    //   "request": "launch",
    //   "name": "Mocha Tests",
    //   "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
    //   "args": [
    //     "-r",
    //     "@babel/register",
    //     "--recursive",
    //     "--timeout",
    //     "999999",
    //     "--colors",
    //     "${workspaceRoot}/test/specs"
    //   ],
    //   "internalConsoleOptions": "openOnSessionStart",
    //   "preLaunchTask": "Build sources"
    // }
  ]
}

Unfortunately my friends at work uses Angular and they have no experience in React/ Electron. Thanks in advance.

Edit: I uploaded results of trace:true to this site):




Asked on community.mm . Can be closedd.

1 Like