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: 
It’s because Heroku thinks you are deploying a Node app. But what you are deploying is **the `public` directory** of a Node app, not Node code.

Heroku uses buildpacks to select how the ap is handled. You want to clear that Node association:

`buildpacks:clear # clear all buildpacks set on the app`

Which means that “Next release will detect buildpack normally.”, that should solve it for you.

ref: <https://devcenter.heroku.com/articles/buildpacks>
I run into the same issue and tried everything, eventually realized no file would commit because they were already committed and pushed to the github repository.
So you need to do the following:

* Remove old git. folder:

> 
> rm -rf .git
> 
> 
> 

* Create new git:

> 
> git init
> 
> 
> 

* Add all project files:

> 
> git add .
> 
> 
> 

* Commit:

> 
> git commit -m “commit name”
> 
> 
> 

* Creat new heroku application:

> 
> heroku create
> 
> 
> 

* Push code to master:

> 
> git push heroku master
> 
> 
> 

This worked for me.