How to Fix Nodejs Heroku Running into Error?

Viewed 31

I followed the step to upload my backend to Heroku from this video: https://www.youtube.com/watch?v=rSkxia0ZZQ0, and I got this error:

Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 16 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 3.14 KiB | 1.57 MiB/s, done.
Total 10 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/timanovsky/subdir-heroku-buildpack.git
remote:        2. heroku/nodejs
remote: -----> Subdir buildpack app detected
remote: PROJECT_PATH is undefined
remote:  !     Push rejected, failed to compile Subdir buildpack app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: aad8206689cb2d86d27ef0e2a124aa9701bf8a7b
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version aad8206689cb2d86d27ef0e2a124aa9701bf8a7b
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to heroku-skiplagged-final.
remote:
To https://git.heroku.com/heroku-skiplagged-final.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/heroku-skiplagged-final.git'

Procfile:

web: node backend/backend.js

Picture of my Folders

Procfile Photo

Package.json Photo

PROJECT_PATH and BuildPacks from Heroku

Video Link with the error above: https://youtu.be/T6eWAdPVOJI

1 Answers

Heroku sees that you made some changes in your visual studio code or what are you using and it's telling you that you didn't push on git the last version of your app.

remote: ! ## Warning - The same version of this code has already been built: aad8206689cb2d86d27ef0e2a124aa9701bf8a7b remote: ! remote: ! We have detected that you have triggered a build from source code with version aad8206689cb2d86d27ef0e2a124aa9701bf8a7b

You need to commit your changes in the project and push them to git and after you can push the git on the heroku server.

Related