简体   繁体   English

Gulp 服务器不工作

[英]Gulp server doesn't work

I'm using Gulp and I've installed gulp-livereload and gulp-connect to set up a development server.我正在使用 Gulp 并且我已经安装了gulp-livereloadgulp-livereload gulp-connect来设置开发服务器。 Here's my gulpfile.js :这是我的gulpfile.js

"use strict";
const gulp = require('gulp');
const livereload = require('gulp-livereload');
const connect = require('gulp-connect');

gulp.task('connect', () => {
  connect.server({
    root: 'app',
    livereload: true
  });
});

When I run gulp connect in my shell, the server does start on localhost:8080 , but when I try to navigate to it, it returns me a 404 error.当我在 shell 中运行gulp connect时,服务器确实在localhost:8080上启动,但是当我尝试导航到它时,它返回一个 404 错误。 I'm working on Win10 and use Microsoft Edge.我正在使用 Win10 并使用 Microsoft Edge。 What have I done wrong?我做错了什么?

假设你在app/index.html有一个 index.html 文件,那个 gulp 文件没有问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM