0

I am trying to push my gulp node app to heroku. In the package.json I have "postinstall": "gulp serveprod" to run a gulp command that starts a webserver.

In package.json

"scripts": {
    "start": "node app",
    "postinstall": "gulp serveprod",
    ...etc
}

My gulp task:

gulp.task('serveprod', function() {
  connect.server({
    root: 'app',
    host: '',
    port: process.env.PORT,
    livereload: false,
    open: false
  });
});

When I run 'gulp serveprod' in the terminal the app works fine on localhost. However when I run 'gulp push heroku" I get the following that stays until it timesout:

  postinstall /tmp/build_c27e9c799bef2671ed033b271feecf87
remote:        > gulp serveprod
remote:        
remote:        [03:54:36] Using gulpfile /tmp/build_c27e9c799bef2671ed033b271feecf87/gulpfile.js
remote:        [03:54:36] Starting 'serveprod'...
remote:        [03:54:36] Finished 'serveprod' after 12 ms
remote:        [03:54:36] Server started http://localhost:8080

My understanding is that the gulp server is using localhost by default and I need to specify the host where heroku will host the app. However I have no idea what to put as 'host'.

I looked at this answer and tried '0.0.0.0' which didn't work. I have also tried http://infinite-lowlands-6023.herokuapp.com/ which is the name of my app which got a similar result, pushing to heroku would just stop at this gulp task. I have followed this question that helped me get through other issues but I am now well and truly stuck on this one.

What do I need to do to deploy this to Heroku successfully? What information needs to go in the 'host' value?

Thanks :)

Community
  • 1
  • 1
Max
  • 1
  • if you do `host : '0.0.0.0'` what do you see on line `Server started`?? – harishr Aug 09 '15 at 04:18
  • Server started http://localhost:8080 – Max Aug 11 '15 at 10:28
  • Here is a link to my github repo for the project :) [portfolio site repo](https://github.com/max888/portfolio_ang_app) – Max Aug 11 '15 at 10:32
  • I really do not think that host 0.0.0.0 will say localhost:8080, can you please recheck – harishr Aug 12 '15 at 04:25
  • Sorry that is my mistake. It says "Server started http ://0.0.0.0:8080" (there is no space after the http but needed to put to stop stack overflow turning into link) – Max Aug 13 '15 at 12:09
  • exactly so server does gets started, and its started successfully.. thing is you don't know of your website, there is some page from where you can get that... so click on the address and check - mostly your website site is up – harishr Aug 13 '15 at 12:15
  • So do I keep the host as 0.0.0.0? Is this part correct or do I need to put something else here? For example if I go to my heroku app url http://infinite-lowlands-6023.herokuapp.com/ I get an error – Max Aug 13 '15 at 12:30
  • have you tried runing your website locally... as is instructed on heroku website.. if not first try doing that (using localhost) if everything works... then push and check on heroku with 0.0.0.0.. it should work.. if it doesnt just raise a ticker.. the heroku guys are very helpful.. will surely try n help – harishr Aug 13 '15 at 13:11

0 Answers0