【问题标题】:Gulp server doesn't workGulp 服务器不工作
【发布时间】:2016-09-19 12:56:21
【问题描述】:

我正在使用 Gulp,并安装了 gulp-livereloadgulp-connect 来设置开发服务器。这是我的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
  });
});

当我在 shell 中运行 gulp connect 时,服务器确实在 localhost:8080 上启动,但是当我尝试导航到它时,它返回了 404 错误。我正在开发 Win10 并使用 Microsoft Edge。我做错了什么?

【问题讨论】:

  • 你能告诉我们app目录中有什么吗(有index.html文件)吗?
  • 请把它作为答案发布,这就是问题所在——我没有用index.html 创建一个app 目录。我的坏:(
  • @Nix 谢谢!我可以在 8 分钟内接受它

标签: javascript gulp gulp-connect


【解决方案1】:

假设您在app/index.html 有一个 index.html 文件,那么 gulp 文件没有任何问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-02
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 2011-03-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多