电脑某些组件自动更新之后,使用VScode打开上午刚编写的网页开始报错了。
筛查之后发现是.vscode文件下的launch.json文件出现了问题,导致网页启动错误(又或者报错Access Error: 404 -- Not Found Cannot locate document
),如果遇到了文件调试问题,可以尝试修改launch.json文件代码。
代码如下:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "${file}",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "nodeLauch", //单独调试js,即可以直接运行js
"type": "node",
"request": "launch",
"program": "${file}", //这个配置成你要调试的文件、${file}当前打开的文件
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"preLaunchTask": "",
"sourceMaps": false
}
]
}
参考自文章https://blog.csdn.net/weixin_34185320/article/details/88705312?spm=1001.2014.3001.5506