Meteor Visual Studio Code in MacOS

Compiled from a few sources here is my launch.json for launching meteor from Visual Studio code on MacOS. Debugger for Chrome must be installed. Currently running VSCode 1.26.1. My meteor project is on 1.6

I left my settings notation there as it was a little confusing to keep the settings file on it’s own line. Making a single --settings settings.json line added extra single quotes to the resulting launch attempt.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Meteor: Chrome",
            "url": "http://localhost:3000",
            "webRoot": "${workspaceFolder}"
        },
        {
            "type": "node",
            "request": "launch",
            "name": "Meteor: Server",
            "cwd": "${workspaceRoot}/",
            "runtimeExecutable": "/usr/local/bin/meteor",
            "runtimeArgs": [
                "run",
                "--inspect",
                "--settings",
                "settings.json"
            ],
            "restart": true,
            "timeout": 30000,
            "stopOnEntry": false,
            "sourceMaps": true,
            "port": 9229
        }
    ],
    "compounds": [
        {
            "name": "Meteor: All",
            "configurations": ["Meteor: Server", "Meteor: Chrome"]
        }
    ]
}
3 Likes

I have found better success with attaching to both the chrome and meteor server processes. It survives restarts better. Here is my code…

{
  "version": "0.2.0",
  "configurations": [
    {
        "type": "node",
        "request": "attach",
        "name": "server",
        "restart": true,
        "port": 9229,
    },
    {
        "type": "chrome",
        "request": "attach",
        "name": "Attach Chrome",
        "url": "http://localhost:3010/",
        "webRoot": "${workspaceFolder}",
        "port": 9222
    },

I run Meteor from a regular shell. I have defined a npm script so I just run npm run debug which does what your launch command does (ie specifying --inspect and the settings file.

To attach to chrome you will need to run it from the command line and specify the debug port with the option --remote-debugging-port=9222

The above example assumes you are running Meteor on port 3010 - edit to suit your config. You will need to navigate Chrome to the root of your app the first time you want to connect.

1 Like