PHP artisan optimize returns bitBucket 管道错误

PHP artisan optimize returns error on bitBucket Pipeline

我正在尝试将 bitBucket 管道与 Laravel 一起使用。但是每次 运行 管道 return 都会出现以下错误:

> post-install-cmd: Illuminate\Foundation\ComposerScripts::postInstall
> post-install-cmd: php artisan optimize --verbose
Generating optimized class loader
Compiling common classes
Script php artisan optimize --verbose handling the post-install-cmd event returned with an error

  [RuntimeException]  
  Error Output:       

Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:196
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:94
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:350
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:134
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:189
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:120
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25

bitbucket-pipelines.yml:

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: phpunit/phpunit:5.0.3

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - composer install --verbose

问题已解决,我需要设置一些环境变量。

更具体地说,我使用了一个名为 rollbar 的收集错误服务(顺便说一下,真的很好)

config/services.php中是这样设置的:

'rollbar' => [
    'access_token' => env('ROLLBAR_ACCESS_TOKEN'),
    'level' => env('ROLLBAR_LEVEL', 'error'),
],

我只需要在 BitBucketSettings/PIPELINES/Environment variables 中设置 ROLLBAR_ACCESS_TOKEN 变量