Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Help.How to languch chrome in wsl #44

Open
GinmusWJQ opened this issue Apr 28, 2023 · 0 comments
Open

Need Help.How to languch chrome in wsl #44

GinmusWJQ opened this issue Apr 28, 2023 · 0 comments

Comments

@GinmusWJQ
Copy link

GinmusWJQ commented Apr 28, 2023

My environment is wsl2 and Ubuntu 20.04.4LTS
My neovim configuration is extened by LazyVim.And I want to debug React or Vue in neovim.

The error message is:"unable to find an installation of the browser on your system.Try installing it,or providing an absolute path to the browser in the 'runtimeExecutable' in your launch.json"

I think I have the right debugger_path.So I doubt it is a problem with wsl.But I can run the react project perfectly in the wsl2 and open the chrome directly by click the terminal website address when i run npm run dev.And i saw vscode-js-debug/blob/main/OPTIONS.md#browserlaunchlocation says

In a remote workspace (through ssh or WSL, for example) this can be used to open the browser on the remote machine rather than locally.

I don't know where the problem is?

Here is my configuration

 {
    "mxsdev/nvim-dap-vscode-js",
    event = "VeryLazy",
    dependencies = {
      "mfussenegger/nvim-dap",
      {
        "microsoft/vscode-js-debug",
        lazy = true,
        build = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out"
      }
    },
    config = function()
      local dap = require("dap")
      local dap_js = require("dap-vscode-js")
      -- vscode-js configuration for debugging support
      local DEBUG_PATH = vim.fn.stdpath("data") .. "/lazy/vscode-js-debug"
      dap_js.setup({
        node_path = "node",
        debugger_path = DEBUG_PATH,
        adapters = { "pwa-node", "node-terminal", "pwa-chrome" }, -- which adapters to register in nvim-dap
      })
      for _, language in ipairs({ "typescript", "javascript", }) do
        dap.configurations[language] = {
          {
            type = "pwa-node",
            request = "launch",
            name = "launch file (" .. language .. ")",
            program = "${file}",
            cwd = "${workspacefolder}",
          },
          {
            type = "pwa-node",
            request = "attach",
            name = "attach (" .. language .. ")",
            processid = require("dap.utils").pick_process,
            cwd = "${workspacefolder}",
          }
        }
      end
      for _, language in ipairs { "typescriptreact", "javascriptreact" } do
        require("dap").configurations[language] = {
          {
            type = "pwa-chrome",
            name = "Attach - Remote Debugging",
            request = "attach",
            program = "${file}",
            cwd = vim.fn.getcwd(),
            sourceMaps = true,
            protocol = "inspector",
            port = 9222,
            webRoot = "${workspaceFolder}",
          },
          {
            type = "pwa-chrome",
            name = "Launch Chrome",
            request = "launch",
            url = "http://localhost:3005",
            browserLaunchLocation = "workspace",
          },
        }
      end
    end
  },
@GinmusWJQ GinmusWJQ reopened this Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant