1、官网下载安装新版本node、完成安装;
2、打开终端 npm node -v查看版本,检查安装是否成功;
3、简单的搭建服务:
var http =require("http");
var fs =require("fs");
var server=http.createServer(function(request,response){
var path = request.url;
if(path==="./favicon.ico"){
fs.readFile("register.html",function(err,data){//读取文件操作
response.writeHead(200,{"Content-Type":"text/html; charset=utf-8"});
response.write(data);
response.end();
});
}else{
//指定响应成功、编码集
response.writeHead(200,{"Content-Type":"text/html; charset=utf-8"});
response.write("hello node" );
response.end();
}
}).listen("8080");
console.log("server start");
注:导入vue项目检验配置node、启动项目,npm install npm run dev等