2016-11-09 59 views
0

我需要從源代碼控制中自動執行我的生產機器上的laravel項目設置/ 升級Laravel - 無法從我的源代碼控制安裝

我寫了一個bash腳本來克隆GIT倉庫的源代碼並運行安裝程序。

的git的代碼將文件夾/var/www/prod/mainapp/,所以下面的bash代碼git的命令後運行:

cd /var/www/prod/mainapp/app/ 
composer install # composer update will not work as well 
php artisan dump-autoload 
php artisan optimize 

我收到以下錯誤,當代碼達到:php artisan optimize

PHP Fatal error: Class 'App\Providers\SocialUserProvider' not found in /var/www/prod/mainapp/app/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146

我app.php

我有以下提供:

App\Providers\FacebookGraphProvider::class, 
    Torann\GeoIP\GeoIPServiceProvider::class, 
    App\Providers\SocialUserProvider::class, 

這是我composer.json:

{ 
    "name": "laravel/laravel", 
    "description": "The Laravel Framework.", 
    "keywords": ["framework", "laravel"], 
    "license": "MIT", 
    "type": "project", 
    "require": { 
     "php": ">=5.5.9", 
     "laravel/framework": "5.2.*", 
     "torann/geoip": "0.2.3" 
    }, 
    "require-dev": { 
     "fzaninotto/faker": "~1.4", 
     "mockery/mockery": "0.9.*", 
     "phpunit/phpunit": "~4.0", 
     "symfony/css-selector": "2.8.*|3.0.*", 
     "symfony/dom-crawler": "2.8.*|3.0.*" 
    }, 
    "autoload": { 
     "classmap": [ 
      "database", 
      "app/Facades", 
      "app/Services" 
     ], 
     "psr-4": { 
      "App\\": "app/" 
     } 
    }, 
    "autoload-dev": { 
     "classmap": [ 
      "tests/TestCase.php" 
     ] 
    }, 
    "scripts": { 
     "post-root-package-install": [ 
      "php -r \"copy('.env.example', '.env');\"" 
     ], 
     "post-create-project-cmd": [ 
      "php artisan key:generate" 
     ], 
     "post-install-cmd": [ 
      "Illuminate\\Foundation\\ComposerScripts::postInstall", 
      "php artisan optimize" 
     ], 
     "post-update-cmd": [ 
      "Illuminate\\Foundation\\ComposerScripts::postUpdate", 
      "php artisan optimize" 
     ] 
    }, 
    "config": { 
     "preferred-install": "dist" 
    } 
} 
+0

刪除'軟件\供應商\ SocialUserProvider ::類,'從服務供應商名單,然後'作曲家install' –

+0

@RisulIslam但這不是穩健的,這是我應該做的我每次升級時間?它沒有任何意義... – SexyMF

+0

確保在App \ Providers中有一個名爲'SocialUserProvider'的文件。 –

回答

1

您需要向類圖添加一行來告訴誰應該自動加載。 app/Providers

"classmap": [ 
     "database", 
     "app/Facades", 
     "app/Services", 
     "app/Providers" //this is the missing part. 
    ] 
0

我遇到了幾次。

我的解決方法是運行

composer install --no-scripts 

你得到這個錯誤是由於前期在composer.json文件,並通過添加標誌,安裝過程中,你跳過這些腳本安裝腳本。

一旦你安裝了所有東西,你就可以像平常一樣使用composer installcomposer update