0

So here's my composer.json file:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=7.0.0",
    "laravel/framework": "5.1.*",
    "illuminate/support": "5.1.*",
    "laravelcollective/html": "^5.1.9",
    "twilio/sdk": "^5.4.2",
    "monolog/monolog": "1.11.*",
    "maatwebsite/excel": "^2.1.8",
    "fideloper/proxy": "^3.3.4",
    "sentry/sentry": "^1.0",
    "barryvdh/laravel-dompdf": "^0.7",
    "dompdf/dompdf": "0.7.0 as 0.6.2",
    "phenx/php-font-lib": "0.4 as 0.2.2"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.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"
}
}

I have a local version that works perfectly fine, but when I try to deploy to our server I get

PHP Fatal error:  Interface 'Monolog\ResettableInterface' not found in /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php on line 28 Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255

I've looked everywhere and the only fixes I've found were to manually download and add ResettableInterface.php and place it in the monolog vendor directory but I can't do that as it's installed then tested automatically by the deployer script and if it fails it won't deploy so I don't get a chance to do this. What do I do?

Mitch
  • 107
  • 1
  • 2
  • 9
  • Are you running `composer install` or `composer update`? – Travis Britz Feb 28 '19 at 01:51
  • composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader – Mitch Feb 28 '19 at 01:55
  • It pulls a fresh site install from git and then runs installation for the dependencies – Mitch Feb 28 '19 at 01:57
  • In that case, it's possible your existing composer lock file has some mismatched dependencies. You could try running `composer update` again, committing the new lock file, and then redeploying to see if that resolves the missing class – Travis Britz Feb 28 '19 at 02:10

1 Answers1

2

Try removing or renaming the vendor folder and Composer.lock file. Now run composer install . This will create the vendor folder with all its new dependencies.

Arun P
  • 541
  • 4
  • 11