如何解决 Bitbucket 管道错误:vendor/bin/phpunit: 没有这样的文件或目录

问题描述 投票:0回答:1

对于我的 Laravel 应用程序,我创建了一个

bitbucket-pipeline
:

image: php:8.0
  pipelines:
     branches:
          stage:
         - step:
           name: Install Dependencies
      caches:
        - composer
        - node
      script:
        - apt-get update && apt-get install -y unzip libpng-dev libjpeg-dev libfreetype6-dev
        - docker-php-ext-configure gd --with-freetype --with-jpeg
        - docker-php-ext-install gd
        - curl -sS https://getcomposer.org/installer | php
        - mv composer.phar /usr/local/bin/composer
        - composer install --no-scripts
        - curl -sL https://deb.nodesource.com/setup_16.x | bash -
        - apt-get install -y nodejs
        - npm install --legacy-peer-deps
  - step:
      name: Run Tests
      script:
        - vendor/bin/phpunit
  - step:
      name: Build Assets
      caches:
        - node
      script:
        - npm run prod
  - step:
      name: Migrate Database
      script:
        - php artisan migrate --force
        - php artisan key:generate
        - php artisan jwt:secret
      services:
        - mysql

      definitions:
        services:
           mysql:
           image: mysql:5.7

     caches:
       composer: ~/.composer/cache
       node: ~/.npm

到目前为止一切顺利,但是当我运行它时,我收到错误:

bash: vendor/bin/phpunit: No such file or directory

我检查了该文件夹是否存在并且一切正常,但我仍然收到错误。

有人可以帮我吗?

php laravel bitbucket bitbucket-pipelines
1个回答
0
投票

尝试使用绝对路径。

/var/www/your-project/vendor/bin/phpunit

我认为“运行测试”步骤必须在“迁移数据库”之后。

© www.soinside.com 2019 - 2024. All rights reserved.