0

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

2
  • Does the file /var/www/lcp-api/app/bootstrap.php.cache exist? Commented Oct 1, 2017 at 18:07
  • No, that's the problem I do not have this file. I checked in other post and they say that Symphony generate it Commented Oct 1, 2017 at 18:10

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

When I run the second command I get this "v2.1.62" do you know what it means?
That's odd, build_bootstrap should not give any output if all went well. It's not the Symfony or Sensio version number, because their 2.1.x versions don't go up to 62. Are you using a reasonably recent version of Symfony? We're up to version 3.3.9 (or 2.8.27 if you're stuck on 2). I can't replicate that behavior on either version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.