Deployment to Laravel Forge throwing faker not found Exception

I am trying to deploy a laravel project to forge and I get the following exception:

Symfony\Component\Debug\Exception\FatalErrorException]  
Class 'Faker\Factory' not found     

I have a faker link in require-dev in composer.json!

composer.json file

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",
    "tymon/jwt-auth": "0.5.*",
    "dingo/api": "1.0.x@dev"
},
"require-dev": {
    "fzaninotto/faker": "~1.5",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1",
    "laracasts/testdummy": "1.*",
    "laracasts/generators": "^1.1"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan optimize"
    ],
    "post-root-package-install": [
        "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
}

}

Deploying a script in Forge:

git pull origin master 
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
php artisan db:seed --class="StaticDataSeeder"

I was able to deploy the same project locally without any problems, and the linker update on forge also completed successfully, and I see how the faker package loads.

Please let me know if I missed something.

+4
source share
1 answer

There is a clear conflict that explains your problem:

  • You have added the package "fzaninotto/faker"to the section require-dev.

  • composer install --no-dev, , require-dev.

, , require --no-dev .

+17

Source: https://habr.com/ru/post/1609125/


All Articles