PHP部署在Heroku -Push失败



我一直在尝试在Heroku上部署PHP应用程序,但我一直遇到此错误:

-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
       ERROR: neither your composer.json 'require' section nor any
       dependency therein requires a runtime version, but 'require-dev'
       or a dependency therein does. Heroku cannot automatically select
       a default runtime version in this case.
       Please add a version requirement for 'php' to section 'require'
       in composer.json, 'composer update', commit, and deploy again.
 !     ERROR: Couldn't load 'composer.lock'; it must be a valid lock
       file generated by Composer and be in a consistent state.
       Check above for any parse errors and address them if necessary.
       Run 'composer update', add/commit the change, then push again.
 !     Push rejected, failed to compile PHP app.
 !     Push failed

有人知道我如何解决它?

,所以这是我要看的,如果这些假设中的任何一个是错误的,否则我正在经历您已经完成的工作。

  1. 您的作曲家应将其分为要求和要求dev。需要在本地添加要求Derec-Dev的生产中安装。

{ "name": "something/something", "description": "A description of my project", "type": "project", "require": { "php": ">=5.5.9", "doctrine/cache": "1.4.*", "elasticsearch/elasticsearch": "~2.0", "monolog/monolog": "~1.0", "knplabs/github-api": "~1.2", "ezyang/htmlpurifier": "~4.6", "easyrdf/easyrdf": "0.9.*", "hoa/compiler": "~2.15", "hoa/visitor": "~1.15", "collectiveaccess/service-wrapper": "v1.1", "phpoffice/phppresentation": "dev-master", "phpoffice/phpword": "v0.13.*" }, "require-dev": { "phpunit/phpunit": "4.3.*", "maximebf/debugbar": ">=1.0.0" } }

  1. 如果您没有安装作曲家,则需要这样做。https://www.hostinger.com/tutorials/how-to-install-composer

  2. php composer update的第一个实例中运行php composer install,以安装您的依赖项。

  3. 请提交所有内容,除了供应商文件以及任何缓存或日志记录。这将包括Composer.lock,它是已安装依赖项列表和您正在使用的版本。

  4. Heroku将在生产中安装这些依赖项,以确保其使用与锁定文件中指定的相同版本。

相关内容

  • 没有找到相关文章

最新更新