Heroku can't get /

I am new to Heroku and believe that I follow all the steps described on the Heroku website to deploy via node.js - https://devcenter.heroku.com/articles/getting-started-with-nodejs , but, despite signs of success, I only see this in the browser when I go to my newly-generated site herokuapp.com.

Unable to get /

No execution errors

git push heroku master 

My procfile is just

 web: node app.js 

I still don't quite understand the dinosaurs, but it seems like one of them works:

heroku ps === web (1X): node app.js web.1: up 2014/07/03 23:55:00 (~ 18m ago)

Then:

open the hero. Opening the name of the application ... done

But https://APP-NAME.herokuapp.com/ just displays the Cannot GET / message.

+12
git gitignore deployment heroku
source share
5 answers

I had my dist directory included in my .gitignore file, so I did not run dist to my repo and did not click it on Heroku. Therefore, Heroku could not find service content.

I updated my .gitignore, committed and clicked, and now my application shows up in great shape on Heroku.

+28
source share

almost 3 years, but I am responsible for the link.

  • Usually / dist is a generated generated directory, it is temporary and changes a lot when working in our sources, therefore / dist is not supported by the version .
  • on your .json package you can add a script called postinstall with this build process, suppose you have a task in gulp called build ... so that "postinstall": "gulp build"
  • if you also manage your project dependencies in gower, npm install --save bower and "postinstall": "./ node_modules / bower / bin / bower install & gulp build"

Just a simple example created for your package.json

 { "dependencies: { "bower":"^1.8.0", "grunt":"^1.0.1", }, "scripts": { "start": "node ./www.js", "build": "grunt dist", "postinstall": "./node_modules/bower/bin/bower install && npm run build" } } 

Obviously, you probably did better now ... I just refer to it for the following consultations.

+7
source share

I think you have not added files to git. Whatever file you edit on your local computer, you need git add xyz.ext , git commit -m "Message" , git push heroku master -u ( -u save the parameters 'heroku master', so in the future you will need to add just type git push ), in short, every time you are asked to deploy the application, you need git add , git commit , git push . Hope this helps.

+2
source share

I don't know why this worked, but I changed the location of my angular /dist from [root]client/dist to [root]/dist , which is at the same directory level as server.js

+1
source share

Adding these two lines to server.js worked for me:

var distDir = __dirname + "/dist/"; app.use(express.static(distDir));

My dist structure is as follows:

enter image description here

0
source share

All Articles