Laravel Vapor:无法找到您项目的依赖项

Laravel Vapor: Unable to find your project's dependencies

我正在尝试通过 laravel vapor 部署我的更改,它告诉我:

/home/runner/work/_temp/c6e18c6d-a186-46b8-9628-a123b8013114.sh: line 1: Merge: command not found
/home/runner/work/_temp/c6e18c6d-a186-46b8-9628-a123b8013114.sh: line 3: hot-fix/vapor-issue: No such file or directory
Unable to find your project's dependencies. Please run the composer "install" command first.
Error: Process completed with exit code 1.

我尝试更改 vapor.yml 中的内容,但没有解决任何问题:

environments:
    staging:
        timeout: 10
        concurrency: 94
        warm: 20
        storage: str-staging
        memory: 768
        cli-memory: 768
        runtime: 'php-7.4'
        database: db-development
        scheduler: false
        queue: true
        queue-concurrency: 1
        queue-timeout: 120
        queue-memory: 768
        mail: false
        domain:
            - staging.example.com
        build:
            - 'composer install -o --no-dev'
            - 'php artisan event:cache'
            - 'php artisan config:cache'
            - 'php artisan route:cache'
        deploy:
            - 'php artisan migrate --force'

有什么想法吗?

他好像找不到文件。错误消息告诉您先 运行: composer install。那将解决问题。

我找到了解决办法。

这是因为两个问题,它们都在 .github/workflows/ 中的 yml 配置中,我发现 github 改变了他们的行为。

我的 yml 配置有如下部分:

- name: Deploy using Laravel Vapor
      env:
        VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
      run: /home/runner/.composer/vendor/bin/vapor deploy production --commit=`${{ github.event.head_commit.id }}` --message=`${{ github.event.head_commit.message }}`

但是他们删除了对反引号 (`) 的处理,所以我将其更改为双引号:

- name: Deploy using Laravel Vapor
      env:
        VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
      run: /home/runner/.composer/vendor/bin/vapor deploy production --commit="${{ github.event.head_commit.id }}" --message="${{ github.event.head_commit.message }}"

这解决了这两行问题:

/home/runner/work/_temp/c6e18c6d-a186-46b8-9628-a123b8013114.sh: line 1: Merge: command not found
/home/runner/work/_temp/c6e18c6d-a186-46b8-9628-a123b8013114.sh: line 3: hot-fix/vapor-issue: No such file or directory

另一个问题:

Unable to find your project's dependencies. Please run the composer "install" command first.
Error: Process completed with exit code 1.

我必须在使用 laravel vapor 部署之前添加 composer install

yml 配置更改:

- name: Install Composer dependencies
      run: composer install --prefer-dist --no-interaction --no-dev
- name: Deploy using Laravel Vapor
      env:
        VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
      run: /home/runner/.composer/vendor/bin/vapor deploy production --commit="${{ github.event.head_commit.id }}" --message="${{ github.event.head_commit.message }}"

这对我有帮助,希望对其他人也有帮助。