尝试将 chrome 设置为 mac 上 VSCode 的默认浏览器

发布于 2025-01-20 22:28:45 字数 2103 浏览 4 评论 0原文

我找到了这篇文章:在VS代码中运行Chrome Debugger

我在那里遵循答案,并在我的启动中设置以下内容。json:

      {
        "name": "Launch Chrome",
        "request": "launch",
        "type": "pwa-chrome",
        "url": "https://localhost:44444/health/status",
        "webRoot": "${workspaceFolder}/public",
        "runtimeExecutable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
      }

问题是,当我运行“启动Chrome”选项时,它会正确打开Chrome,但我的项目 /服务器尚未启动。我真正需要做的是,当我按F5调试项目时,我希望系统启动IIS Express,加载服务器项目,然后在清理所有缓存的情况下打开Chrome。

因此,我试图对此进行更改:

            "launchBrowser": {
              "enabled": true,
              "args": "${auto-detect-url}",
              "windows": {
                  "command": "cmd.exe",
                  "args": "/C start ${auto-detect-url}"
              },
          "osx": {
              "command": "open"
          },
              "linux": {
                  "command": "xdg-open"
              }
          }

对此:

            "launchBrowser": {
              "enabled": true,
              "args": "${auto-detect-url}",
              "windows": {
                  "command": "cmd.exe",
                  "args": "/C start ${auto-detect-url}"
              },
              "osx": {
                  "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
              },
              "linux": {
                  "command": "xdg-open"
              }
          }

但是我在调​​试控制台中收到以下错误:

crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.

我也尝试更新设置。但是我不知道要指定什么值:

"debug.javascript.defaultRuntimeExecutable": {

"pwa-chrome": "",
    "pwa-node": "node"
}

I found this article: Problem to run chrome debugger in VS Code

I followed the answer there and set up the following in my launch.json:

      {
        "name": "Launch Chrome",
        "request": "launch",
        "type": "pwa-chrome",
        "url": "https://localhost:44444/health/status",
        "webRoot": "${workspaceFolder}/public",
        "runtimeExecutable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
      }

The problem is that when I just run that "Launch Chrome" option, it opens Chrome correctly but my project / server hasn't started yet. What I really need to do is when I press F5 to debug my project, I'd like the system to start iis express, load my server project and then open chrome with all the cache cleaned up.

So I tried to change this:

            "launchBrowser": {
              "enabled": true,
              "args": "${auto-detect-url}",
              "windows": {
                  "command": "cmd.exe",
                  "args": "/C start ${auto-detect-url}"
              },
          "osx": {
              "command": "open"
          },
              "linux": {
                  "command": "xdg-open"
              }
          }

to this:

            "launchBrowser": {
              "enabled": true,
              "args": "${auto-detect-url}",
              "windows": {
                  "command": "cmd.exe",
                  "args": "/C start ${auto-detect-url}"
              },
              "osx": {
                  "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
              },
              "linux": {
                  "command": "xdg-open"
              }
          }

but I get the following errors in my debug console:

crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.
chromewebdata/(index)꞉6549:22:6774
crbug/1173575, non-JS module files deprecated.

I've also tried to update settings.json but I don't know what values to specify:

"debug.javascript.defaultRuntimeExecutable": {

"pwa-chrome": "",
    "pwa-node": "node"
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠檬 2025-01-27 22:28:45

默认情况下,我可以使用此 launchBrowser 配置在 OSX 上的 Chrome 中打开我的 swagger 页面。

"launchBrowser": {
    "enabled": true,
    "args": "${auto-detect-url}",
    "windows": {
        "command": "cmd.exe",
        "args": "/C start ${auto-detect-url}/swagger"
    },
    "osx": {
        "command": "open",
        "args": "${auto-detect-url}/swagger"
    },
    "linux": {
        "command": "xdg-open"
    }
},

OSX Chrome arg 应该只是所需的启动 URL。

警告:看来,使用此配置,当我停止调试时,Chrome 会完全关闭。

I was able to get my swagger page to open in Chrome on OSX by default using this launchBrowser config.

"launchBrowser": {
    "enabled": true,
    "args": "${auto-detect-url}",
    "windows": {
        "command": "cmd.exe",
        "args": "/C start ${auto-detect-url}/swagger"
    },
    "osx": {
        "command": "open",
        "args": "${auto-detect-url}/swagger"
    },
    "linux": {
        "command": "xdg-open"
    }
},

The OSX Chrome arg should just be the desired launch URL.

Word of warning: It seems that, with this configuration, when I stop debugging, Chrome is completely closed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文