Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js

后端 未结 18 2278
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 23:54

With a downloaded and installed version of Visual Studio Code 1.2.1, and a 64bit version of node.exe msi placed in my working directory (I am assuming that is correct), how

相关标签:
18条回答
  • 2020-12-08 00:44

    On OSX and VSCode 1.50.0 all I had to do was to close and restart VSCode and the problem went away.

    0 讨论(0)
  • 2020-12-08 00:47

    The cause for me receiving this error was trying the new pre-release VSCode JS debugger.

    If you opted in, change via User settings:

        "debug.javascript.usePreview": true|false
    

    Everything in my normal configuration and integrated terminal was correct and finding executables. I wasted a lot of time trying other things!

    0 讨论(0)
  • 2020-12-08 00:48

    To follow up, I just ran into this as well. When I installed Node.js there was an option that said Add to PATH (Available After Restart). Seems like Windows just needs a restart to make things work.

    0 讨论(0)
  • 2020-12-08 00:50

    first run below commands as super user sudo code . --user-data-dir='.' it will open the visual code studio import the folder of your project and set the launch.json as below

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "node",
                "request": "launch",
                "name": "Launch Program",
                "program": "${workspaceFolder}/app/release/web.js",
                "outFiles": [
                    "${workspaceFolder}/**/*.js"
                ],
                "runtimeExecutable": "/root/.nvm/versions/node/v8.9.4/bin/node"
            }
        ]
    }
    

    path of runtimeExecutable will be output of "which node" command.

    Run the server in debug mode cheers

    0 讨论(0)
  • 2020-12-08 00:52

    Had the same issue and in my case it was a problem with a vs code extension. Try running code as:

    $ code --disable-extensions
    

    Once in the editor, I ran my program in the debug mode and worked, and then started code with

    $ code
    

    And it continued working fine.

    Hope it works for you.

    0 讨论(0)
  • 2020-12-08 00:53

    Quick fix that works for me. Navigate to the root directory of your folder from command line (cmd). then once you are on your root directory, type:

    code . 
    

    Then, press enter. Note the ".", don't forget it. Now try to debug and see if you get the same error.

    0 讨论(0)
提交回复
热议问题