question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploy to Heroku Issue

See original GitHub issue

I can’t figure out how to deploy gulp-webserver to Heroku. Has anyone tried this? Here is my gulpfile:

    var gulp = require('gulp');
    var webserver = require('gulp-webserver');
    var mainBowerFiles = require('main-bower-files');
    var inject = require('gulp-inject');
    var del = require('del');

    var paths = {
        temp: '.tmp',
        tempVendor: '.tmp/vendor',
        tempIndex: '.tmp/views/index.html',

        index: 'app/views/index.html',
        appSrc: ['app/**/*', '!app/views/index.html'],
        bowerSrc: 'bower_components/**/*',
    };

    gulp.task('default', ['watch']);

    gulp.task('watch', ['serve'], function () {
        gulp.watch(paths.appSrc, ['scripts']);
        gulp.watch(paths.bowerSrc, ['vendors']);
        gulp.watch(paths.index, ['copyAll']);
    });

    gulp.task('serve', ['copyAll'], function () {
        return gulp.src(paths.temp)
            .pipe(webserver({
                host: '0.0.0.0',
                port: '8000',
                fallback: 'index.html',
                livereload: false,
                proxies: [{
                    source: '/api',
                    target: 'http://localhost:1337'
                }]
            }));
    });

    gulp.task('copyAll', function () {
        var tempVendors = gulp.src(mainBowerFiles()).pipe(gulp.dest(paths.tempVendor));

        var appFiles = gulp.src(paths.appSrc).pipe(gulp.dest(paths.temp));

        return gulp.src(paths.index)
            .pipe(gulp.dest(paths.temp))
            .pipe(inject(tempVendors, {
                relative: true,
                name: 'vendorInject'
            }))
            .pipe(inject(appFiles, {
                relative: true
            }))
            .pipe(gulp.dest(paths.temp));

    });

    gulp.task('vendors', function () {
        var tempVendors = gulp.src(mainBowerFiles()).pipe(gulp.dest(paths.tempVendor));

        return gulp.src(paths.tempIndex)
            .pipe(inject(tempVendors, {
                relative: true,
                name: 'vendorInject'
            }))
            .pipe(gulp.dest(paths.temp));
    });

    gulp.task('scripts', function () {

        var appFiles = gulp.src(paths.appSrc).pipe(gulp.dest(paths.temp));

        return gulp.src(paths.tempIndex)
            .pipe(inject(appFiles, {
                relative: true
            }))
            .pipe(gulp.dest(paths.temp));
    });

    gulp.task('clean', function () {
        del([paths.temp]);
    });

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
CiscoKidxxcommented, Nov 17, 2015

add host: ‘0.0.0.0’ so it looks like this:

‘use strict’;

/**

  • Hosts the dist folder on a specific port.
  • Example Usage:
  • gulp server */ var gulp = require(‘gulp’), webserver = require(‘gulp-webserver’);

gulp.task(‘server’, function() { return gulp.src(‘./dist/’).pipe(webserver({ host: ‘0.0.0.0’, port: process.env.PORT || 5000, https: false, open: true })); });

On Tue, Nov 17, 2015 at 9:47 AM, Anthony Hastings notifications@github.com wrote:

In my package.json I have:

scripts: { ‘start’: ‘gulp server’ }

and my server task is as follows:

‘use strict’;

/**

  • Hosts the dist folder on a specific port.
  • Example Usage:
  • gulp server */ var gulp = require(‘gulp’), webserver = require(‘gulp-webserver’);

gulp.task(‘server’, function() { return gulp.src(‘./dist/’).pipe(webserver({ port: process.env.PORT || 5000, https: false, open: true })); });

— Reply to this email directly or view it on GitHub https://github.com/schickling/gulp-webserver/issues/94#issuecomment-157409784 .

1reaction
anthonyhastingscommented, Nov 17, 2015

That’s done the trick; thank you! It was really trippy that the original author of the ticket was the one who gave me the solution though 😄

Perhaps close this ticket now since you also seem to have sorted it for yourself?

Thanks again, Anthony

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack.
Read more >
Heroku: Most Common Errors Explained - Papertrail
In this post, we'll discuss in detail three common Heroku errors and explain why these errors happen and how to solve them.
Read more >
7. When It Goes Wrong - Heroku: Up and Running [Book]
Deploy Debugging · Check the status site. · Reproduce the problem in another app. · Copy config, add-ons, and labs features. · Check...
Read more >
Heroku app successfully deploying, but receiving application ...
Based just on the sample here it looks like you've bound it to a version of python that has a known security issue,...
Read more >
3 tricks for solving the `Heroku Application Error` - Medium
After deploying your MongoDB site on Heroku you maybe not expecting this error. photo by Google. Honestly speaking I've also faced this error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found