已设置firefoxExecutable,Visual Studio Code仍无法找到Firefox?
VS Code调试Firefox找不到可执行文件的原因及修复
导致VS Code无法识别Firefox路径的核心问题有两个:
- JSON路径未转义:JSON字符串里的反斜杠
\是转义字符,你配置里写的C:\Program Files\Mozilla Firefox\firefox会被解析成错误路径,必须把反斜杠改成双反斜杠\\,或者换成正斜杠/。 - 缺少可执行文件后缀:Windows系统下Firefox的启动程序是
firefox.exe,你只写了firefox,系统找不到对应的可执行文件。
修正后的配置代码如下:
{ "name": "Mappings localhost", "type": "firefox", "request": "launch", "reAttach": true, "url": "http://localhost:4200/index.html", "pathMappings": [{ "url": "http://localhost:4200/", "path": "${workspaceFolder}" }], "firefoxExecutable": "C:\\Program Files\\Mozilla Firefox\\firefox.exe", "firefoxArgs": ["-start-debugger-server=6000"] }
另外还可以排查这两点:
- 确认Firefox确实安装在
C:\Program Files\Mozilla Firefox目录下,如果是自定义安装路径,要同步修改配置里的路径。 - 检查VS Code的「Debugger for Firefox」插件是否为最新版本,旧版本可能存在路径解析的兼容性问题。
内容的提问来源于stack exchange,提问作者user18928007
相关产品推荐
相关产品推荐

