1
votes

Everytime I run the command composer install --no-dev I am getting this error, I am using maatwebsite in laravel as the error pointing out, I just don't know how to fix it.

PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError
: Class 'PHPExcel_Shared_Font' not found in /var/www/laravel/config/excel.php:18
2 Stack trace:

0 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap

/LoadConfiguration.php(60): require()

1 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap

/LoadConfiguration.php(38): Illuminate\Foundation\Bootstrap\LoadConfiguration->l
oadConfigurationFiles(Object(Illuminate\Foundation\Application), Object(Illumina
te\Config\Repository))

2 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Applicati

on.php(203): Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap(Object
(Illuminate\Foundation\Application))

3 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/K

ernel.php(268): Illuminate\Foundation\Application->bootstrapWith(Array)

4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/K

ernel.php(114): Illuminate\Foundation\Console\Kernel->boo in /var/www/laravel/co
nfig/excel.php on line 182 Script php artisan optimize handling the post-install-cmd event returned with er
ror code 255

Update: This is the composer.json file content

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "maatwebsite/excel": "~2.1.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || 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"
    }
}
1
Can you show the contents of your composer.json file?Rwd
@RossWilson I already added the content of my composer.json fileMr.Unknown

1 Answers

1
votes

I would assume the reason you getting this error is because you're running --no-dev and you have maatwebsite/excel listed as a require-dev dependency.

You'll need to remove it as a dev dependency and then require it as a normal dependency and it should be fine.

Hope this helps!