alejandromav
alejandromav

Reputation: 943

Can´t deploy a NodeJS app on Heroku

I've done a NodeJS app that runs flawlessly in my local machine. I've tried to deploy into Heroku, but when I curl it, it says "Application error".

This is my package.js:

{
    "name": "maybe",
    "version": "0.0.1",
    "description": "desc",
    "repository": "local heroku",
    "author": "me",
    "engines": {
        "node": "0.8.x",
        "npm": "1.1.x"
    },
    "dependencies": {
        "express": "3.0.0rc2",
        "request": "2.9.202",
        "jade": "~0.27.2",
        "path": "~0.4.9",
        "aws-sdk": "2.0.23",
        "knox": "~0.3.1"
    },
    "scripts": {
        "start": "web.js"
    }
}

As you can see, I use aws-sdk yo upload a file to S3.

If I perform "heroku run bash", I can "node server.js" and It seems to run correctly.

My port is "port = process.env.PORT || 3000;", being my env variable also PORT=3000.

So, any idea about whats going wrong????

Thank you in advance.

Upvotes: 1

Views: 563

Answers (2)

rdegges
rdegges

Reputation: 33864

You can usually find out why things aren't working by inspecting the Heroku logs. If you open your terminal and run:

heroku ps:restart; heroku logs --tail

That will restart your app, and open your logs files so you can see what error messages Heroku is giving you. This way you can see what the issue is and fix it quickly =)

Upvotes: 1

Neelp22
Neelp22

Reputation: 82

Have you defined a Procfile so that Heroku knows which file to run?

See here - https://devcenter.heroku.com/articles/getting-started-with-nodejs#define-a-procfile

Upvotes: 2

Related Questions