Forge上部署引发伪造者的异常

Forge上部署引发伪造者的异常

本文介绍了未在Laravel Forge上部署引发伪造者的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在伪造上部署一个laravel项目,但出现以下异常:

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

我在composer.json的require-dev中有一个造假者参考!

I have the faker reference in require-dev in composer.json!

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"
}

}

Forge中的部署脚本:

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"

我能够在本地部署相同的项目,而没有任何问题,并且在forge上的作曲家更新也成功运行,并且我可以看到安装了仿造软件包.

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.

推荐答案

有一个明确的冲突可以解释您的问题:

There is a clear conflict that explains your problem:

  1. 您已将"fzaninotto/faker"程序包添加到require-dev部分.

您正在使用--no-dev选项运行部署composer install命令,该选项明确禁止安装require-dev中列出的软件包.

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

因此解决方案是在部署时将软件包移至require部分或删除--no-dev选项.

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

这篇关于未在Laravel Forge上部署引发伪造者的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:26