Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment on Laravel Forge throwing faker not found Exception

I am trying to deploy a laravel project on forge and i am getting the below exception :

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

I have the faker reference 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"
}

}

Deployment 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 with out any problem and composer update on forge also runs successfully and i can see the faker package getting downloaded.

Please let me know if i am missing something.

like image 608
vthallam Avatar asked Sep 26 '15 19:09

vthallam


1 Answers

There is a clear conflict that explains your problem:

  1. You've added the "fzaninotto/faker" package to the require-dev section.

  2. You're running the deployment composer install command with the --no-dev option which explicitly prohibits installing the packages listed in require-dev.

So the solution is either to move the package to the require section or remove the --no-dev option when deploying.

like image 66
Bogdan Avatar answered Oct 10 '22 02:10

Bogdan