heroku上的应用程序错误-未找到'composer.json' [英] Application error on heroku - No 'composer.json' found

查看:104
本文介绍了heroku上的应用程序错误-未找到'composer.json'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试访问我的heroku页面时,它说

When I try to access my heroku page it says

应用程序错误应用程序中发生错误,无法为您的页面提供服务.如果您是应用程序所有者,请检查日志以获取详细信息"

"Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details"

这是我的构建日志:

检测到PHP应用程序!警告:未找到"composer.json".使用 'index.php'将应用程序类型声明为PHP被认为是旧版 功能,并可能导致意外行为.自举... 正在安装平台软件包...注意:不需要运行时 composer.lock;使用PHP ^ 5.5.17 Apache(2.4.20)Nginx(1.8.1)PHP (5.6.30)安装依赖项... Composer版本1.4.1 2017-03-10 09:29:45正在准备运行时环境...注意:否Procfile,使用 网络:heroku-php-apache2".检查是否有其他扩展 安装...发现过程类型Procfile声明类型-> Web 压缩中...完成:13.9M启动中...发布了v119部署到 Heroku构建完成的博客职业文档

PHP app detected ! WARNING: No 'composer.json' found. Using 'index.php' to declare app type as PHP is considered legacy functionality and may lead to unexpected behavior. Bootstrapping... Installing platform packages... NOTICE: No runtime required in composer.lock; using PHP ^5.5.17 apache (2.4.20) nginx (1.8.1) php (5.6.30) Installing dependencies... Composer version 1.4.1 2017-03-10 09:29:45 Preparing runtime environment... NOTICE: No Procfile, using 'web: heroku-php-apache2'. Checking for additional extensions to install... Discovering process types Procfile declares types -> web Compressing... Done: 13.9M Launching... Released v119 deployed to Heroku Build finished Blogs Careers Documentation

================================================ ========================

========================================================================

推荐答案

composer.lock文件不仅必须存在于本地,还必须提交.这样,当您推送到Heroku时,它将包括在内.

The composer.lock file doesn't just have to exist locally, it has to be committed. That way it will be included when you push to Heroku.

尝试这样的事情:

git add composer.lock
git commit -m "Add Composer lock file"
git push heroku

这样做的原因是composer.json通常以某种模糊的方式指定依赖项,例如无论最新的1.2.x版本是什么"或"master分支上的最新提交".您可能会想象,根据我们安装依赖项的时间,您和我可能会得到不同的结果.

The reason for this is that composer.json generally specifies dependencies in a somewhat vague way, e.g. "whatever the latest 1.2.x release is" or "the latest commits on the master branch". You can probably imagine that you and I might get different results depending on when we install our dependencies.

composer.lock文件的工作是以更严格的方式锁定这些依赖项.如果您安装了库的最新1.2.x版本,则其精确版本会记录在composer.lock中,例如"Git哈希为1234abc的版本1.2.2".

The composer.lock file's job is to lock these dependencies down in a more rigorous way. If you install the latest 1.2.x release of a library, its precise version is recorded in composer.lock, e.g. "version 1.2.2 at Git hash 1234abc".

通常,除非您有意更新库,否则最好使用composerinstall而不是composer更新.前者使用锁定文件中的确切版本,并且不更新任何内容.这样,我们可以更有信心使用相同的库.后者会更新新版本并更改锁定文件.

In general, unless you are deliberately updating libraries it is better to use composerinstall, not composer update. The former uses the exact versions from the lock file and doesn't update anything. That way we can have more confidence that we are using identical libraries. The latter updates new versions and changes the lock file.

我从未在PHP中使用过Heroku,但是它想要安装锁定文件中列出的确切版本是有道理的.

I've never used Heroku with PHP, but it makes sense that it wants to install the exact versions listed in the lock file.

这篇关于heroku上的应用程序错误-未找到'composer.json'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆