0

I am trying to set up a project on Heroku. I went through their tutorial for Node apps and I am now trying to use my repository to work on my web app. I have already created the project and it shows up on my Heroku dashboard but I can't push anything to it. This is the message I get every time:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/nodejs
remote: 
remote:  !     Push rejected, failed to detect set buildpack heroku/nodejs
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to your_web_app.

I've made sure the buildpack is set to nodejs. I used information from Heroku along with Heroku wrongly detecting my Node app as a Ruby app, but still I cannot deploy.

I also already went into the package.json file and added in my node version under the "engine" section. Why can't I deploy to Heroku still?

EDIT: Here is my package.json file:

{
  "name": "node",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  },
  "engines": {
    "node": "5.7.0"
  }
}
4
  • can you share your package.json? Commented Mar 5, 2016 at 16:26
  • @ZeeshanHassanMemon I just posted it. Sorry for the late response Commented Mar 7, 2016 at 17:07
  • @ZeeshanHassanMemon my procfile only has one line: web: node index.js I got this from going through the tutorial on heroku Commented Mar 7, 2016 at 17:35
  • i got it, it seems you made some changes in your app like added package.json later or something else that caused heroku buildpack confusion, heroku buildpacks:clear //will clear buildpack heroku buildpacks:set heroku/nodejs //will set correct buildpack Commented Mar 7, 2016 at 17:41

1 Answer 1

1

Ensure following things:

1- app has a package.json file in the root directory.

2- app has node version defined in package.json as:

"engines": {
    "node": "4.1.1"
  },

Edit: buildpacks fix,

heroku buildpacks:clear //clear buildpack

heroku buildpacks:set heroku/nodejs //set correct build pack for node.js app

OR

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs -a your-app-name

Sign up to request clarification or add additional context in comments.

3 Comments

Zeeshan, I do have a package.json file in the root directory and I just posted the contents in my original question. Why should I set node as version 4.1.1? When I run node --version I get v5.7.0 so that's why I have that instead of 4.1.1
please try updated answer and let me know if it works for you
This worked! I also have a couple things wrong with my git remote names but I got those worked out separately. These commands correctly set my buildpack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.