gpt4 book ai didi

visual-studio-code - 无法在vscode中运行网页

转载 作者:行者123 更新时间:2023-12-05 02:52:26 38 4
gpt4 key购买 nike

我是 vscode 新手。

我的问题可能看起来很愚蠢。

我有 3 个文件:index.htmlindex.jsindex.css

我安装了 chrome 调试扩展,但不知道如何运行我的代码

如果我想运行/调试我在 chrome 中收到这个错误

chrome ERR_CONNECTION_REFUSED

我确定问题出在 launch.json 文件上。在这里:

{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}

我想要的是要启动的index.html

最佳答案

由于您没有运行任何网络服务器以使其在本地主机上查看,因此您不能将 url 设置为 localhost 而是简单地告诉 chrome 从您的工作区打开文件。

{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "${workspaceFolder}/index.html", // <-- This should be the path of the index.html file relative to the workspace
"webRoot": "${workspaceFolder}"
}
]
}

关于visual-studio-code - 无法在vscode中运行网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62611349/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com