Home > Development Tools > VSCode > body text

How to configure node in vscode

青灯夜游
Release: 2023-01-13 00:40:58
Original
23037 people have browsed it

vscode配置node环境的方法:1、下载安装vscode和node;2、在vscode软件中,点击侧边栏的“运行调试”按钮,添加nodejs配置文件launch.json;3、编写launch.json文件然后保存即可。

How to configure node in vscode

本教程操作环境:windows7系统、Dell G3电脑、Visual Studio Code 1.53.2。

Visual Studio Code搭建NodeJs的开发环境

1、下载安装NodeJs并配置环境变量

2、下载安装 VS Code编辑器

3、vscode配置nodejs调试环境

  • 侧边栏 调试按钮 添加 nodejs 配置 launch.json

    How to configure node in vscode

  • 编写 launch.json 配置文件

// nodemon 配置{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "nodemon",
            "runtimeExecutable": "nodemon",
            "program": "${workspaceFolder}\\server\\bin\\www",
            "restart": true,
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen"
        }
    ]}
Copy after login

运行项目调试服务 添加断点 查看数据传值

相关推荐:《vscode基础教程》、《nodejs 教程

4、调试

创建Hello word Demo

How to configure node in vscode

创建测试服务器server.js

var http=require('http');
 
http.createServer(function(req,res){
    res.writeHead(200,{'Content-Type':'text/plain'});
    res.end('hello node.js');
}).listen(3000,'localhost',function(){
    console.log('Server running at http://localhost:3000');
});
Copy after login

更多编程相关知识,请访问:编程入门!!

The above is the detailed content of How to configure node in vscode. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!