在vs code中,我已经在一个HTML AngularJS项目中创建了一个
launch.json
文件。但是我无法在本地主机上启动该项目。它一直显示为Failed to load resource: net::ERR_CONNECTION_REFUSED (http://localhost:8080/)
。
项目结构:
Project => .vscode => launch.json
=> app
=> scripts
=> styles
=> index.html
launch.json:-
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach to Chrome, with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
}
有人能帮我解决这个问题吗?谢谢提前。
/etc/hosts
? - Abraham Gnanasinghhosts
的文件。使用cat /etc/hosts
命令可以确保localhost
是一个有效的主机名。我曾经遇到过这样的问题,但我不确定这是否也是你的情况。 - Yan Yanglaunch.json
在 VS Code 中运行。 - Abraham Gnanasingh