Because when installing Chrome, you do not choose the installation path like other software installation programs, etc. Instead, Chrome is installed directly in the current user directory. If you move the installation location of Chrome, the problem that Windows cannot find Chrome will occur.
This problem can be solved by configuring the tasks.json file.
The specific method is as follows:
1. Press ctrl shift p to open the command panel, enter Configure Task and then operate in sequence
2. Then click the last one to open the file and enter tasks.json. We can see that the default configuration is as follows:
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "echo", "type": "shell", "command": "echo Hello" } ] }
We need to modify this code as follows:
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "Run HTML file with Chrome", "type": "process", "command": "chrome", "args": ["${file}"], "windows": { //这里写你电脑的Chrome浏览器的安装位置 "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" }, "group": { "kind": "build", "isDefault": true } } ] }
After saving, open the file and press Ctrl Shift B will open the browser.
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of Solution to the problem that vscode prompts that the chrome browser cannot be found. For more information, please follow other related articles on the PHP Chinese website!