我正在尝试将bitbucket管道与laravel一起使用。但是,每次运行管道时都会返回以下错误:
> post-install-cmd: IlluminateFoundationComposerScripts::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
ComposerEventDispatcherEventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:94
ComposerEventDispatcherEventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:350
ComposerInstaller->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:134
ComposerCommandInstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:256
SymfonyComponentConsoleCommandCommand->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:838
SymfonyComponentConsoleApplication->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:189
SymfonyComponentConsoleApplication->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
ComposerConsoleApplication->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:120
SymfonyComponentConsoleApplication->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
ComposerConsoleApplication->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'),
],
我只需要在bitbucket上的Settings/PIPELINES/Environment variables
中设置ROLLBAR_ACCESS_TOKEN
变量