MEAN Stack – Deploy to Heroku – Day 30(i)

The MEAN Challenge Continues!

This video is part of the 30 Day MEAN Stack Honolulu Challenge

In this video we’ll deploy our MEAN.js app to Heroku

We look at:
– Downloading the Heroku toolbelt from https://toolbelt.heroku.com/
– Signing up to Heroku from https://www.heroku.com/
– Deploying to Heroku:

> heroku login
> heroku create
> git push heroku master
> heroku config:set NODE_ENV=production
> heroku open

18 Comments

Let me know what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Tarun
    Reply

    Nice videos shristi…I am stuck in deploying the application on herku…After running ‘git push heroku master’, getting following error:

    error: src refspec master does not match any.
    error: failed to push some refs to ‘https://git.heroku.com/meanappbossable.git’

  • adamkfowlerAdam
    Reply

    Hi Shristi,

    Thank you so much for this series! It’s just what I’ve been hoping to find. You alluded to the possibility of setting this up on other cloud hosting services…Do you by chance have instructions to deploy this to google cloud?

  • Joshua
    Reply

    Hi Shristi,

    This tutorial series is simply put, amazing! I have not seen something that walks you from beginning to end in meanjs. I have learned so much! Thank you very much for such an informative series!

    I did run into an issue on the final deploy to Heroku. I received the error “An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.” I then ran the command Heroku logs and found the errors stating that it could not connect to MongoDB. I followed your instruction on creating a new Sandbox MongoDB in Compose, referring to it in my production.js file, and including my username and password as well. Not sure what might be the case here, but could I be missing something?

    Regards,
    Josh K.

    • Joshua

      So I seem to have solved my problem with the MongoDB connection. There was a string right after the Mongo URI I added to the production.js file that needed to be removed. Now, after deploying to heroku and opening, the logs seem normal and the page “seems” to be loading content (elements are added in developer tools with no errors in console), but the page is rendering blank (white). Have you heard of this happening before?

    • bossable

      Hey Joshua,

      Thanks for checking out the tutorial series, I’m really glad that you found it informative 🙂

      Let’s figure out what might be causing your heroku blank page.

      Can you confirm that you did a build before deploying? (you should have a set of files in the public/dist folder).
      1. You might have to remove “public/dist/” from your .gitignore file, and
      2. Add your built dist files (the files in public/dist/) to git,
      then push to Heroku again.

      Let me know how that goes.

  • John Kelleher
    Reply

    Hi Shristi,
    just wanted to heap some praise on your month of MEAN. Watched twice to get every detail. Excellent resource – the best I’ve seen on MEAN as well as mean.js. Might even use it as a resource for my class – I currently lecture with ASP.NET MVC/SQL Server but am looking for the next thing.

    Again, thanks and best of luck with the woman-in-IT crusade – you’re certainly a sterling advertisement!

    J

    P.S. Don’t know if your contact form on bossable.com is working – tried to post originally there.

    • bossable

      Wow!! Thank you so much for the kind words John! I really appreciate you taking the time to leave such awesome feedback. Made my day!

      (Thanks for the tip about the contact form too, I’ll look into it!)

  • chouchua
    Reply

    Hey Shristi,
    I have made it to the end!
    However, Im getting this error when I type “heroku open” on my terminal:
    An error occurred in the application and your page could not be served. Please try again in a few moments.
    If you are the application owner, check your logs for details.

    Thanks for the help,
    Jimmy

    • bossable

      Hey Jimmy – did you try opening the app in your browser, are you seeing errors in your browsers console?

  • karthik
    Reply

    While doing this “git push heroku master” i am getting this error
    “”
    error: src refspec master does not match any.
    error: failed to push some refs to ‘https://git.heroku.com/sheltered-gorge-4666.git’

  • Gaurav
    Reply

    Hi Shrishti,
    Amazing tutorial!
    I am having an issue with deployment. After following the steps, I am getting a blank page. No error in console, nothing in logs. Do we have to make some modifications to .gitignore file before deploying?

    • bossable

      Hey Gaurav, thanks for checking out the tute. I’m assuming that you did a build before deploying?
      If so, from looking at the .gitignore file on github, there has been a recent change which added “public/dist/”

      So, if you remove “public/dist/” from .gitignore, and add your built dist files (the files in public/dist/) to git, then push to Heroku again, it should be okay.