Skip to content

Deploy to Heroku index.html 404 #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jordanbaucke opened this issue Jan 24, 2015 · 19 comments
Closed

Deploy to Heroku index.html 404 #796

jordanbaucke opened this issue Jan 24, 2015 · 19 comments

Comments

@jordanbaucke
Copy link

Running the generator from scratch:

// Generated on 2015-01-24 using generator-angular-fullstack 2.0.13

Deployed to heroku with:

yo angular-fullstack:heroku and than cd dist; heroku addons:add mongolab; all no problems - but than I get:

2015-01-24T21:49:06.675048+00:00 app[web.1]: Express server listening on 34599, in production mode
2015-01-24T21:49:07.298363+00:00 heroku[web.1]: State changed from starting to up
2015-01-24T21:49:10.661311+00:00 app[web.1]: Error: ENOENT, stat '/app/public/index.html'
2015-01-24T21:49:11.359136+00:00 app[web.1]: GET / 404 700ms - 9b

Checking out the /dist/app/public

Jordans-MacBook-Pro:angular-fullstack jordanbaucke$ ls dist/public/
app         assets          bower_components    favicon.ico     index.html      robots.txt

So it seems something is happening to the relativity of the directory structure once I deploy?

@mjroeleveld
Copy link

+1

@gaboesquivel
Copy link
Contributor

Hi, I'm using the same version and I haven't seen that problem. Is that the only error you're getting?
I had an issue connecting to the db using mongohq see gaboesquivel@2fb40ad

@jordanbaucke
Copy link
Author

@gaboesquivel I haven't gotten past this 404 error yet ...

@gaboesquivel
Copy link
Contributor

I mean on the heroku log :) . Is that the only error on the log?

@jordanbaucke
Copy link
Author

@gaboesquivel oh yeah, thats it, here:

2015-02-04T01:03:51.553832+00:00 heroku[web.1]: State changed from down to starting
2015-02-04T01:03:54.027902+00:00 heroku[web.1]: Starting process with command `node server/app.js`
2015-02-04T01:03:57.353738+00:00 app[web.1]: Express server listening on 36457, in production mode
2015-02-04T01:03:57.774556+00:00 heroku[web.1]: State changed from starting to up
2015-02-04T01:03:59.734393+00:00 heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=2cc52313-97ad-4e1f-89c1-2d5842f55a49 fwd="23.246.221.69" dyno=web.1 connect=1ms service=109ms status=404 bytes=297
2015-02-04T01:03:59.630422+00:00 app[web.1]: Error: ENOENT, stat '/app/public/index.html'
2015-02-04T01:03:59.731076+00:00 app[web.1]: GET / 404 103ms - 9b
2015-02-04T01:04:00.082519+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=18740d58-a316-4947-b76f-77a3c0129f47 fwd="23.246.221.69" dyno=web.1 connect=1ms service=19ms status=200 bytes=1043

@gaboesquivel
Copy link
Contributor

I have no idea. If you pack the generated code somewhere I can download it and play it I might be able to help.

@jordanbaucke
Copy link
Author

@gaboesquivel ok, freshly generated: https://github.com/jordanbaucke/angular-fullstack-404

Tested and still getting the 404, tried messing with the path app/public/index.html - as I understand it should just be public/index.html but still no joy?

@kbanashek
Copy link

Having the same exact issue, please post any updates. I'm also not sure that the grunt task is being executed actually creating that output directory.

Thanks
Kyle

@kbanashek
Copy link

I've got this successfully deploying to Heroku after about 8 hours of research, please let me know if you're still interested in learning how to perform this.

@jordanbaucke
Copy link
Author

Yes very much so!

@honkskillet
Copy link

Yes please.

@kbanashek
Copy link

ok, i'll have my solution posted within the next 24 hrs.

@gaboesquivel
Copy link
Contributor

@jordanbaucke sorry man, too much work these days. good to know @kbanashek found a solution

@kbanashek
Copy link

just working through some final steps...give me about an hour or so.

@jordanbaucke
Copy link
Author

all good ... I ended up devising a solution for deploying to AWS and am going to clean up the solution and hopefully contribute it to the generator as an alternative.

@jordanbaucke
Copy link
Author

@kbanashek any chance you might share you solution? In the meantime I'm cooking up my ec2 deployment process for this generator ... hopefully it'll get pulled in once it's done to provide more options.

@kbanashek
Copy link

Sure, I'll post my solution later today - sorry didn't realize it was still needed.

@kbanashek
Copy link

Here's is how I'm deploying to Heroku:

  1. I created a GitHub repository branch specifically for my built application 'gh-pages'.
  2. Within the Heroku admin, I linked my github account and chose the deploy from github option selecting my new branch
    image

image

  1. I use the built in grunt task 'build' to deploy my app to the 'dist' directory within my project (i'm using webstorm)
    image
  2. Next I setup an additional buildcontrol task 'pages' that pushes my recently built 'dist' directory up to my 'gh-pages' branch. Since I setup Heroku to perform automatic deploys, once the commit/push is complete the deployment task will begin. I've also setup notifications on the heroku deploy module to notify me once my changes have been successfully pushed.

image

I like this process as I can now keep my built and source code versioned, you could probably merge the the 2 grunt tasks, however mine seemed to hang upon doing so. Please let me know if you try this and are able to get it to work in one single 'build/deploy' task.

Hope this helps.

@Timvissers
Copy link

I had the same problem when manually deploying via github, but I think it was not meant by the author to do this via github (see readme). Instruction was to add a heroku git in the dist folder. When then following the heroku git instructions for deployment, it works just fine.

The solution from kbanashek solves this problem by adding a github for the dist folder as a workaround.

I think this issue can be closed.

@Awk34 Awk34 closed this as completed Oct 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants