Question: I git cloned a Node.js application (the version specified in the `package.json` being `4.1.2` and that of my local machine being `6.2.2`) and tried to git push on Heroku. But it failed to build and gave this error:

> 
> Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
> 
> 
> 

Now I set the buildpack to heroku/nodejs and I get this message:

```
Buildpack set. Next release on lit-badlands-92088 will use heroku/nodejs.
Run git push heroku master to create a new release using this buildpack.

```

Now when I run `git push heroku master`, I am again told:

```
remote: -----> Failed to detect set buildpack
        https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz  

remote: More info: 
https://devcenter.heroku.com/articles/buildpacks#detection-failure  

remote:  
remote:  !     Push failed  
remote: Verifying deploy...  
remote:  
remote: !       Push rejected to lit-badlands-92088.

```

What could be the possible reasons for the Node.js buildpack not being detected even if I set it?

Answer: 
Some tiny clarifications on other answers:
The error "Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz" or anything similar, means to say the GIT COMMIT you are trying to push to heroku was not DETECTED as a node.js app. (Note the capitals for subtleties).

I recently made a stupid mistake that made me aware of this: Running "ls -a" showed that my package.json and .git files were in the same root directory, as required by heroku. EXCEPT that the package.json file WAS NOT included in my latest git commit. Running "git status" alerted me that package.json was an untracked file. So I added it, and ta-da, pushing to heroku worked. 

If you get an error related to buildpack, check that your GIT COMMIT has a package.json file in the root directory. If this is true, try manually specifying the buildpack with "heroku buildpacks:set heroku/nodejs" (or your desired language). This should resolve most errors related to buildpack detection.
Most apps have at least one of these signatures present, so if you see this error, it usually means an important file isn't checked into your git repository:

* Java: pom.xml
* Ruby: Gemfile
* Node.js: package.json
* Python: requirements.txt / setup.py / Pipfile
* PHP: composer.json / index.php

You should:

```
git add {file}
git commit -am 'added {file} 
git push heroku master

```