PHP artisan optimize在bitBucket Pipeline上返回错误

时间:2016-12-19 17:47:49

标签: php laravel composer-php bitbucket bitbucket-pipelines

我试图将bitBucket Pipeline与Laravel一起使用。但每次运行管道时都会返回以下错误:

> 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

到位桶-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

1 个答案:

答案 0 :(得分:1)

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

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

config/services.php中,它被设置为:

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

我只需要在BitBucket上的ROLLBAR_ACCESS_TOKEN中设置Settings/PIPELINES/Environment variables变量

相关问题