rx1984
rx1984

Reputation: 1222

PHP composer install Problems

I have a big problem with php composer, I run this command

php composer.phar install

but it show me this error

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception


  [RuntimeException]
  An error occurred when executing the "'cache:clear --no-warmup'" command:
  PHP Warning:  require_once(/var/www/lcp-api/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/lcp-api/app/console on line 10
  PHP Fatal error:  require_once(): Failed opening required '/var/www/lcp-api/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/
  lcp-api/app/console on line 10
  .

I check the file composer.json and it seems that everything is okay

"post-install-cmd": [
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-update-cmd": [
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ]
  },

Do you have any idea why I get this error?

Cordially

Upvotes: 0

Views: 1085

Answers (1)

rickdenhaan
rickdenhaan

Reputation: 11328

It seems your bootstrap.php.cache file is missing. This can happen sometimes with Symfony.

The file should be regenerated if you run composer update instead of install. If that doesn't work, you can generate it manually by running this command from the root of your project:

php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

If that also doesn't work, you can try to force your environment to production mode by running composer like this:

SYMFONY_ENV=prod composer install

Keep in mind that if you do that on your development environment, debug-mode will be disabled. This should generate a bootstrap.php.cache file, so you should then be able to re-run composer in dev mode again.

Upvotes: 1

Related Questions