小编Tho*_*een的帖子

Laravel / Symfony:无法加载“应用程序”配置文件

升级Homestead并安装软件包后,我遇到了一个奇怪的错误。在调用时php artisan,给出以下内容作为输出:

In LoadConfiguration.php line 68:

Unable to load the "app" configuration file.
Run Code Online (Sandbox Code Playgroud)

少数人建议这是Windows(10)将文件名大写的原因。但是,这在我的文件夹中看不到,也不适用于我的Ubuntu(18.04)环境。

查看源代码,LoadConfiguration.php我们可以看到它正在使用组件中的Findersymfony/finder

foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
    $directory = $this->getNestedDirectory($file, $configPath);

    $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
Run Code Online (Sandbox Code Playgroud)

问题是查找程序确实返回了某种无法找到我的配置文件的迭代器。一个简单的scandir($configPath)返回所有文件:

.
..
app.php
and all other files
Run Code Online (Sandbox Code Playgroud)

将调用包装起来将iterator_to_array()返回一个空数组[]

通过添加返回以下对象..->in($configPath)->getIterator()

Symfony\Component\Finder\Iterator\PathFilterIterator {#47
  #matchRegexps: []
  #noMatchRegexps: array:2 [
    0 => "#(^|/)\..+(/|$)#"
    1 => "#(^|/)\..+(/|$)#"
  ]
  innerIterator: Symfony\Component\Finder\Iterator\FilenameFilterIterator {#43
    #matchRegexps: array:1 [
      0 => "#^(?=[^\.])[^/]*\.php$#" …
Run Code Online (Sandbox Code Playgroud)

php symfony laravel homestead

9
推荐指数
1
解决办法
517
查看次数

Github 操作在容器中运行步骤

目前,我正在尝试在我的 Github Actions 工作流程中实现一个容器。但是,我很难弄清楚如何在容器本身中运行步骤。

使用以下工作流程:

name: Laravel

on: pull_request

jobs:
  laravel-checks:
    runs-on: ubuntu-latest
    container: thomasowow/laravel-php:7.4

    steps:
    - uses: actions/checkout@v2

    - name: Yarn
      run: |
        yarn
Run Code Online (Sandbox Code Playgroud)

此工作流程会导致以下错误:

/__w/_temp/c399fe7d-6cd2-4cdc-bb06-acc829cddbb8.sh: 1: /__w/_temp/c399fe7d-6cd2-4cdc-bb06-acc829cddbb8.sh: yarn: not found
##[error]Process completed with exit code 127
Run Code Online (Sandbox Code Playgroud)

它无法找到yarnthomasowow/laravel-php:7.4本地运行可用yarn。我已经用 docker 镜像中应该可用的其他东西对此进行了测试,但也没有找到它们。看起来这些步骤没有在容器中执行。

该文档对语法进行了以下说明jobs.<job_id>.container

用于运行作业中尚未指定容器的任何步骤的容器

我知道有些解决方案无需使用容器即可工作,我更愿意使用它。

有人遇到同样的问题或者知道我做错了什么吗?


解决方案

@DannyB 指出我的图像包含以下入口点:

["/bin/bash", "--login", "-c", "tail -f /dev/null"]
Run Code Online (Sandbox Code Playgroud)

这可能是 Github 无法在容器中正常运行的原因。

镜像中需要安装 nvm、node 和yarn

SHELL ["/bin/bash", "--login", "-c"]

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN …
Run Code Online (Sandbox Code Playgroud)

docker github-actions

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

docker ×1

github-actions ×1

homestead ×1

laravel ×1

php ×1

symfony ×1