【问题标题】:cloudControl push rejected: cannot stat filecloudControl 推送被拒绝:无法统计文件
【发布时间】:2014-11-21 08:41:37
【问题描述】:

我正在尝试将我的应用程序推送到 cloudControl,但它似乎没有正确运行构建过程并且一直拒绝我的推送。

这是错误:

C:\Users\Vincent\Documents\GitHub\***>cctrlapp *** push
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (10/10), 4.06 KiB | 0 bytes/s, done.
Total 10 (delta 1), reused 0 (delta 0)
remote:
remote: -----> Receiving push
remote:        Loading composer repositories with package information
remote:        Installing dependencies (including require-dev) from lock file
remote:          - Installing doctrine/lexer (v1.0)
remote:            Downloading: 100%
remote:
remote:          - Installing respect/validation (0.6.1)
remote:            Downloading: 100%
remote:
remote:          - Installing slim/slim (2.4.3)
remote:            Downloading: 100%
remote:
remote:          - Installing zendframework/zend-escaper (2.2.6)
remote:            Downloading: 100%
remote:
remote:          - Installing zf1/zend-exception (1.12.8)
remote:            Downloading: 100%
remote:
remote:          - Installing zf1/zend-session (1.12.8)
remote:            Downloading: 100%
remote:
remote:        zf1/zend-session suggests installing zf1/zend-config (Used in special situations or with special adapters)
remote:        zf1/zend-session suggests installing zf1/zend-db (Used in special situations or with special adapters)
remote:        zf1/zend-session suggests installing zf1/zend-loader (Used in special situations or with special adapters)
remote:        Generating autoload files
remote: cp: cannot stat `/srv/tmp/builddir/code/vendor': No such file or directory
remote:  !     cloudControl push rejected, failed to compile php app
remote:  !
remote: error: hook declined to update refs/heads/master
To ssh://***@cloudcontrolled.com/repository.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'ssh://***@cloudcontrolled.com/repository.git'
Command '['C:\\Program Files (x86)\\Git\\cmd\\git.exe', 'push', u'ssh://***@cloudcontrolled.com/repository.git', 'master']' returned non-zero exit status 1

现在我的项目包含这些文件:

  • /
    • 包括/
      • 供应商/
    • .gitignore
    • composer.json
    • composer.lock
    • index.php

如何让 post-receive 挂钩正确“编译” PHP 应用程序?

这是我的composer.json 文件:

{
    "name": "Hello World",
    "description": "My PHP application",
    "authors": [
        {
            "name": "Vincent",
            "email": " ... @gmail.com"
        }
    ],
    "config": {
        "vendor-dir": "includes/vendor"
    },
    "require": {
        "zendframework/zend-escaper": "2.2.6",
        "respect/validation": "~0.6.1",
        "slim/slim": "~2.4.3",
        "zf1/zend-session": "1.12.8"
    }
}

【问题讨论】:

    标签: php deployment cloudcontrol


    【解决方案1】:

    这里可能存在三个问题:

    • 目录为空。 Git 不会跟踪空目录,因此即使它确实存在于您的工作目录中,它也不存在于存储库中。
    • 目录不为空,但使用.gitignore 忽略。
    • Composer 没有在正确的位置寻找vendor 目录。 /srv/tmp/builddir/code/vendor 意味着它必须存在于/vendor 中,而你的存在于/includes/vendor 中。

    它实际上可能是上述任何一种的组合。为了能够告诉我需要.gitignorecomposer.json 的内容。如果我必须下注,我的钱将在最后一个选项上。

    要解决空目录问题,请确保您的/.gitignore 文件不包含/includes/vendor。然后创建一个/includes/vendor/.gitignore文件,内容如下:

    # Ignore everything in this directory
    *
    # Except this file
    !.gitignore
    

    要修复最新版本,请检查您的 composer.json 和那里设置的“目标目录”。详情请参阅Composer documentation

    【讨论】:

    • 我尝试添加.gitignore 文件,但问题仍然存在。在本地,Composer 将依赖项安装在 /includes/vendor 中,但我不确定为什么在 cloudControl 上不是这种情况。我将编辑我的问题以发布我的composer.json 文件。
    • 鉴于您的composer.json,我们检查并发现它实际上是我bug in our PHP Buildpack。使用自定义供应商目录时,Buildpacks 会中断。直到我们有一个修复,我们希望明天你可以通过将供应商目录放在存储库的根目录中来解决这个问题。我们将在 Github 问题上提供最新进展。
    猜你喜欢
    • 1970-01-01
    • 2018-10-24
    • 2013-09-01
    • 1970-01-01
    • 2017-01-09
    • 2021-09-22
    • 1970-01-01
    • 2019-03-29
    相关资源
    最近更新 更多