【问题标题】:Heroku heroku-nextjs buildpack build failedHeroku heroku-nextjs buildpack 构建失败
【发布时间】:2021-03-26 20:28:45
【问题描述】:

我在 Heroku 中使用免费帐户创建了一个应用程序。

这是我的第一个 Nextjs 应用程序。我创建了一些 React 应用程序并使用 https://github.com/mars/create-react-app-buildpack buildpack 成功部署了它们,

我正在尝试使用https://github.com/mars/heroku-nextjs.git buildpack。推送和尝试构建时,我继续收到以下错误:

Enumerating objects: 695, done.
Counting objects: 100% (695/695), done.
Delta compression using up to 4 threads
Compressing objects: 100% (638/638), done.
Writing objects: 100% (695/695), 406.94 KiB | 1.78 MiB/s, done.
Total 695 (delta 388), reused 20 (delta 13)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: https://github.com/mars/heroku-nextjs.git
remote: -----> App not compatible with buildpack: https://github.com/mars/heroku-nextjs.git
remote:        bash: /tmp/codon/tmp/buildpacks/cc998aa50faebde1ea66717737aec22c884e4936/bin/detect: No such file or directory
remote:
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: b1006412ec2d412e7edaed795dcbceff02d98f82
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version b1006412ec2d412e7edaed795dcbceff02d98f82
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 gurnzapp-test.

我已经阅读了所有可以在网上找到的关于此的内容。 github 问题中最常见的错误是人们将 package.json 放在子目录中。我的 package.json 在根目录中。据我所知,我的项目设置正确。

我试过了:

我不知道为什么我会遇到问题。任何帮助都会很棒:D

【问题讨论】:

    标签: reactjs heroku next.js buildpack


    【解决方案1】:
    remote: Building source:
    remote:
    remote: -----> Building on the Heroku-20 stack
    remote: -----> Using buildpack: https://github.com/mars/heroku-nextjs.git
    remote: -----> App not compatible with buildpack: https://github.com/mars/heroku-nextjs.git
    remote:        bash: /tmp/codon/tmp/buildpacks/cc998aa50faebde1ea66717737aec22c884e4936/bin/detect: No such file or directory
    remote:
    remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
    remote:
    remote:  !     Push failed
    

    上面写着App not compatible with buildpack。

    这不是构建包:
    https://github.com/mars/heroku-nextjs

    这些是构建包:
    https://github.com/mars/create-react-app-buildpack
    https://github.com/heroku/heroku-buildpack-nodejs

    您可以忽略此构建包。它什么都不做。
    https://github.com/ryanbahniuk/nextjs-buildpack

    在此处了解构建包的工作原理:
    https://devcenter.heroku.com/articles/buildpacks

    【讨论】:

    • ... 这一点也不令人困惑。我知道 buildpacks 是如何工作的,而 github 把我弄糊涂了。我没有看到任何提及在自述文件中使用 2 个构建包或任何内容。无论如何,一切都按预期进行。谢谢!
    • 如果您添加这个 buildpack (github.com/ryanbahniuk/nextjs-buildpack/blob/master/bin/compile) 只是为了运行 next build,那么拥有 2 个 buildpack 是不必要的。在package.json 中扩展您的npm build 脚本就足够了。见devcenter.heroku.com/articles/…
    猜你喜欢
    • 1970-01-01
    • 2021-05-19
    • 2021-01-20
    • 1970-01-01
    • 2014-09-25
    • 1970-01-01
    • 2015-02-23
    • 1970-01-01
    • 2020-10-09
    相关资源
    最近更新 更多