Laravel 使用 Composer Install --no-dev 时,Debugbar Provider 上的 Forge 部署脚本失败
Laravel Forge Deployment Script Fails on Debugbar Provider when using Composer Install --no-dev
当我尝试使用此部署脚本使用 Forge 进行部署时:
cd /home/forge/default
git pull origin master
cd /home/forge/default/server
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
失败并抛出以下错误。我在 composer.json 中使用这些依赖项,并且在 require.
中没有开发依赖项
Composer.json
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"nesbot/carbon": "~1.14",
"guzzlehttp/guzzle": "^6.0",
"tymon/jwt-auth": "0.5.*",
"barryvdh/laravel-cors": "^0.7.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"barryvdh/laravel-debugbar": "~2.0"
},
错误
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Barryvdh\Debugbar\ServiceProvider' not found
我该如何解决这个问题,这样部署就不会引入开发依赖项,但又不必更改提供程序的开发设置?或者,我不应该费心设置 --no-dev 并引入所有内容吗?当我放下 --no-dev 标志时有效。
我自己也使用 DebugBar,只是将所有内容都与 composer 结合起来。我只在我的开发机器上显示调试栏:
// AppServiceProvider.php
public function register()
{
if ($this->app->environment('local')) {
// register the service provider
$this->app->register('Barryvdh\Debugbar\ServiceProvider');
// register an alias
$this->app->booting(function()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Debugbar', 'Barryvdh\Debugbar\Facade');
});
}
}
当我尝试使用此部署脚本使用 Forge 进行部署时:
cd /home/forge/default
git pull origin master
cd /home/forge/default/server
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
失败并抛出以下错误。我在 composer.json 中使用这些依赖项,并且在 require.
中没有开发依赖项Composer.json
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"nesbot/carbon": "~1.14",
"guzzlehttp/guzzle": "^6.0",
"tymon/jwt-auth": "0.5.*",
"barryvdh/laravel-cors": "^0.7.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"barryvdh/laravel-debugbar": "~2.0"
},
错误
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Barryvdh\Debugbar\ServiceProvider' not found
我该如何解决这个问题,这样部署就不会引入开发依赖项,但又不必更改提供程序的开发设置?或者,我不应该费心设置 --no-dev 并引入所有内容吗?当我放下 --no-dev 标志时有效。
我自己也使用 DebugBar,只是将所有内容都与 composer 结合起来。我只在我的开发机器上显示调试栏:
// AppServiceProvider.php
public function register()
{
if ($this->app->environment('local')) {
// register the service provider
$this->app->register('Barryvdh\Debugbar\ServiceProvider');
// register an alias
$this->app->booting(function()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Debugbar', 'Barryvdh\Debugbar\Facade');
});
}
}