如何修复Nodejs Heroku运行错误



我按照步骤从这个视频上传我的后端到Heroku:https://www.youtube.com/watch?v=rSkxia0ZZQ0,我得到了这个错误:

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

我的文件夹的图片

Procfile照片

Package.json照片

PROJECT_PATH和来自Heroku 的BuildPack

出现上述错误的视频链接:https://youtu.be/T6eWAdPVOJI

Heroku看到您在visual studio代码或使用的内容中进行了一些更改,它告诉您没有在git上推送应用程序的最后版本。

remote:!##警告-此代码的同一版本已经内置:aad8206689cb2d86d27ef0e2a124aa9701bf8a7b远程:!遥控器:!我们检测到您触发了一个源代码生成版本aad8206689cb2d86d27ef0e2a124aa9701bf8a7b

您需要在项目中提交更改并将其推送到git,然后才能在heroku服务器上推送git。

最新更新