首先肯定是打开一个文件夹了,如果没有生成.vacode文件夹需要自己新建一个
在.vscode中新建launch.json写入
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "program": "${workspaceFolder}/test.js" }, { "type": "node", "request": "launch", "name": "当前文件", "program": "${file}" } ] }
可以选择调试断点的配置环境
推荐方法:打开launch.json点击右下角的添加配置
这里是以node来演示的,选择了nodemon会自动生成配置文件,自动生成如下文件
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "nodemon", "runtimeExecutable": "nodemon", "program": "${workspaceFolder}/app.js", "restart": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } ] }
调试出现以上内容解决办法:
错误原因:其实是3000端口被其他应用程序占用了,只要找到占用该端口的应用程序,杀死它,就好了。
netstat -o -n -a | findstr :3000 taskkill /F /PID 115148
注:15148换成你的占用3000端口的程序PID
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接