Windows 10 setup (including VS Code debugging)



  • I have an Intel Compute Stick which runs Windows 10 that I am planning to use for my mirror. Getting Magic Mirror running was really easy as the manual steps outlined in the README.md file are mostly cross-platform.

    But I wanted to create modules and debug them using VS Code. There are a couple hurdles there.

    1. You can launch Magic Mirror using VS Code. You will have to create a launch.json file as outlined here. Make sure to read the comments as they are helpful. I will put my final file in a reply to this.
    2. You may run into an exception: TypeError: Cannot read property 'name' of undefined in MagicMirror\modules\default\updatenotification\node_helper.js:35:43. The root cause of this is some Error: spawn git ENOENT messages that you may see further up in the log. I think this is an effort to check GitHub for updates…anyways it seems to do something with git and this error means it can’t find git in your path. (Basically if you opened a command prompt and typed git it would tell you that it is an unrecognized command.) Install Git from git-scm.com and that should solve it (must restart VS Code though). The installer has an option about the Windows path–choose to add Git to the path. I had GitHub Desktop installed and it apparently uses its own portable version of Git which it doesn’t add to the path.

    These should get you a good running setup. Debugging works for the main code base but doesn’t seem to work for modules. That is next on my list.



  • My launch.json file:

    {
        // Use IntelliSense to learn about possible Node.js debug attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch",
                "type": "node",
                "request": "launch",
                "program": "${workspaceRoot}\\js\\electron.js",
                "stopOnEntry": false,
                "args": [],
                "cwd": "${workspaceRoot}",
                "runtimeExecutable": "${workspaceRoot}\\node_modules\\.bin\\electron",
                "runtimeArgs": [
                    ".",
                    "--enable-logging"
                ],
                "env": {},
                "console": "integratedTerminal",
                "sourceMaps": false,
                "outDir": null
            },
            {
                "name": "Attach",
                "type": "node",
                "request": "attach",
                "port": 5858,
                "sourceMaps": false,
                "outDir": null
            }
        ]
    }


  • do you know who it works with visual studio 2015?


  • Core Contributors

    @aaronaxvig If you enable it to working. You can be add into a step in project for help to other users.



  • @aaronaxvig To run MagicMirror automatically on startup:

    1. Create a .bat file and put it in the startup folder (Windows Explorer > type “shell:startup” without quotes in the address bar).
    2. Set the contents of the bat file:

    cd your MagicMirror Git repository folder
    npm start


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.