douzao1119 2016-11-09 20:08
浏览 71
已采纳

Laravel - 无法从我的源代码管理中安装

I need to automate my laravel project setup/upgrade on my production machine from source control.

I wrote a bash script to clone the source from the GIT repo and run the setup.

The git code is going to the folder /var/www/prod/mainapp/, so the following bash code is running after the git command:

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

I am getting the following error when the code reaches to: 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

in my app.php i have the following providers:

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

this is my 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"
    }
}
  • 写回答

2条回答 默认 最新

  • du1913 2016-11-10 08:50
    关注

    You need to add to the classmap the line that will tell who should be autoloaded. app/Providers

    "classmap": [
            "database",
            "app/Facades",
             "app/Services",
             "app/Providers" //this is the missing part.
        ]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献