编写一个gulpfile.js文件: gulpfile.js const connect = require("gulp-connect"); function serverFn() { connect.server() { port: 3333, root: './myProj' } } exports.server = serverFn; cmd中输入以下命令: gulp server 执行结果: 服务器开启成功